From 1d44584f7721734f793684c31c8668a535b67f63 Mon Sep 17 00:00:00 2001 From: Omen Apps Date: Tue, 24 Nov 2020 22:52:50 -0500 Subject: [PATCH] Added option to choose directed or undirected graph export --- django_postgresql_dag/transformations.py | 6 +++++- setup.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/django_postgresql_dag/transformations.py b/django_postgresql_dag/transformations.py index 5210e31..b11ada7 100644 --- a/django_postgresql_dag/transformations.py +++ b/django_postgresql_dag/transformations.py @@ -194,6 +194,7 @@ def nx_from_queryset( node_attribute_fields_list=None, edge_attribute_fields_list=None, date_strf=None, + digraph=False, ): """ Provided a queryset of nodes or edges, returns a NetworkX graph @@ -208,7 +209,10 @@ def nx_from_queryset( if graph_attributes_dict is None: graph_attributes_dict = {} - graph = nx.Graph(**graph_attributes_dict) + if not digraph: + graph = nx.Graph(**graph_attributes_dict) + else: + graph = nx.DiGraph(**graph_attributes_dict) if queryset_type == "nodes_queryset": nodes_queryset = queryset diff --git a/setup.py b/setup.py index e81dcf5..02e9ca2 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os from setuptools import setup -version = '0.1.5' +version = '0.1.6' classifiers = [ "Development Status :: 3 - Alpha",