Consistent interface for (directed) graph creation
See original GitHub issueThis toy example suggests a problem with our current approach to creating graphs:
In [13]: A = np.array([[0,1,0],[1,0,1],[0,0,0]])
In [14]: A
Out[14]:
array([[0, 1, 0],
[1, 0, 1],
[0, 0, 0]])
In [15]: import networkx as nx
In [16]: G = nx.from_numpy_array(A)
In [17]: G.is_directed()
Out[17]: False
It seems that if we have an asymmetric matrix we need to be explicit about using the nx.DiGraph constructor.
A utility function for determining which graph constructor to use (and performing other potentially useful preprocessing, like removing self-loops) would probably be useful here.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Implementing a New Interface for Directed Graph Analysis by ...
Abstract. We have developed a multiplatform application that provides an easy-to- use alternative for structural analysis of directed graphs.
Read more >4.2 Directed Graphs - Algorithms, 4th Edition
A directed graph (or digraph) is a set of vertices and a collection of directed edges that each connects an ordered pair of...
Read more >Using directed graphs to define viewpoints to keep a ...
Viewpoints need to define consistency rules. ... The work presented in this article shows that directed graphs can be used to define ...
Read more >GraphsExplained · google/guava Wiki - GitHub
A graph is directed if each of its edges are directed, and undirected if each of its edges are undirected. ( common. graph...
Read more >Meta-modeling game for deriving theory-consistent ...
We first review the directed graph approach that enables us to generate and utilize a decision tree to represent the modeling process (Section...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Making explicit a conversation with @leotrs: I’m not sure that
from_numpy_arraystrictly requires networkx 2.2, but the arguments I’m passing to thecreate_usingparameter follow a style used in 2.2. If need be, I suspect we can rewrite some things to be 2.0-compatible, but for the sake of simplicity let’s just bump the requirements for now. (Networkx 2.3 will be out soon anyway.)@jkbren @tlarock Note that now that this is merged it might affect the distance heatmaps. Let me know if something has dramatically changed.