nxviz icon indicating copy to clipboard operation
nxviz copied to clipboard

I have vertex.txt and triangle.txt, how to create a networkx graph?

Open tanjia123456 opened this issue 4 years ago • 2 comments

hello, I have vertex.txt and triangle.txt, how to create a networkx graph? my source file hasn't edge information I have used matplotlib to create a graph, but I can't use nx.adjacency_matrix(G) function to get adj_matrix. My ultimate goal is to generate adjacency matrix

tanjia123456 avatar Sep 10 '20 08:09 tanjia123456

I have used matplotlib to build a graph, but there is no function to directly find the adjacency matrix (1) According to vertex and triangle, use networkx to generate graph, and then use nx.adjacency_matrix function to generate adjacency matrix (2) Extract edge information from triangle.txt, and then use networkx to generate graphs based on edge and vertex (3) Convert the graph generated by matplotlib directly into the graph of networkx, and then use nx.adjacency_matrix to generate the adjacency matrix

Don't know which method is feasible

tanjia123456 avatar Sep 10 '20 08:09 tanjia123456

@tanjia123456 I think this is a question to be brought to the NetworkX issue tracker, as I am seeing some conceptual misunderstandings that might be difficult to resolve here. For example, NetworkX provides the graph object, while matplotlib merely renders the graph to screen. They are not equivalent. I'd recommend looking through the Network Analysis Made Simple tutorial to learn how to use the NetworkX API first.

ericmjl avatar Sep 13 '20 23:09 ericmjl