Skip to content

Instantly share code, notes, and snippets.

@rjurney
Created September 29, 2023 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjurney/60cda25a7a61e712709cdcd6a1a7e8cd to your computer and use it in GitHub Desktop.
Save rjurney/60cda25a7a61e712709cdcd6a1a7e8cd to your computer and use it in GitHub Desktop.
I made a networkx network and a DGL network. They match :) I am pleased.
# The DGL network has sentence encoded JSON for node features.
In [26]: g
Out[26]:
[Graph(num_nodes=27770, num_edges=352807,
ndata_schemes={'x': Scheme(shape=(384,), dtype=torch.float64)}
edata_schemes={})]
# The networkx network parsed the records and has inidividual fields for analysis
In [27]: G
Out[27]: <networkx.classes.digraph.DiGraph at 0x14fe5c4c0>
# Do the two networks match?
In [28]: G.number_of_nodes(), G.number_of_edges()
Out[28]: (27770, 352807)
# For our next trick, the DGLGraph gets labels...
{
"Authors": "Paul S. Aspinwall",
"Comments": "82 pages, 8 figures, LaTeX2e, TASI99, refs added and some typos fixed",
"Date": "Sat, 1 Jan 2000 00:02:31 GMT",
"From": "Paul S. Aspinwall",
"Paper": "hep-th/0001001",
"Published": 946684800,
"Report-no": "DUKE-CGTP-00-01",
"Title": "Compactification, Geometry and Duality: N=2",
"file_id": 1001,
"sequential_id": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment