Skip to content

Commit 1d44584

Browse files
Added option to choose directed or undirected graph export
1 parent f83d7b4 commit 1d44584

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

django_postgresql_dag/transformations.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def nx_from_queryset(
194194
node_attribute_fields_list=None,
195195
edge_attribute_fields_list=None,
196196
date_strf=None,
197+
digraph=False,
197198
):
198199
"""
199200
Provided a queryset of nodes or edges, returns a NetworkX graph
@@ -208,7 +209,10 @@ def nx_from_queryset(
208209
if graph_attributes_dict is None:
209210
graph_attributes_dict = {}
210211

211-
graph = nx.Graph(**graph_attributes_dict)
212+
if not digraph:
213+
graph = nx.Graph(**graph_attributes_dict)
214+
else:
215+
graph = nx.DiGraph(**graph_attributes_dict)
212216

213217
if queryset_type == "nodes_queryset":
214218
nodes_queryset = queryset

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
from setuptools import setup
55

6-
version = '0.1.5'
6+
version = '0.1.6'
77

88
classifiers = [
99
"Development Status :: 3 - Alpha",

0 commit comments

Comments
 (0)