<commit_before>NetworkX Examples
=================

.. include:: Menu.txt

See the examples at
https://networkx.lanl.gov/wiki/browser/networkx/trunk/doc/examples/

And the gallery at
https://networkx.lanl.gov/wiki/wiki/gallery

Basic
-----

>>> from networkx import *
>>> G=Graph()
>>> G.add_edge(1,2)
>>> G.add_edge(2,3)
>>> G.add_edge(2,4)
>>> G.add_edge(2,5)
>>> G.add_edge(2,6)
>>> G.add_edge(4,6)

Print the nodes of the graph

>>> print G.nodes()
[1, 2, 3, 4, 5, 6]

Print the degree of each node

>>> for v in G.nodes():
...     print v,G.degree(v)
... 
1 1<commit_msg>changed "v in G.nodes()" to "n in G"<commit_after>NetworkX Examples
=================

.. include:: Menu.txt

See the examples at
https://networkx.lanl.gov/wiki/browser/networkx/trunk/doc/examples/

And the gallery at
https://networkx.lanl.gov/wiki/wiki/gallery

Basic
-----

>>> from networkx import *
>>> G=Graph()
>>> G.add_edge(1,2)
>>> G.add_edge(2,3)
>>> G.add_edge(2,4)
>>> G.add_edge(2,5)
>>> G.add_edge(2,6)
>>> G.add_edge(4,6)

Print the nodes of the graph

>>> print G.nodes()
[1, 2, 3, 4, 5, 6]

Print the degree of each node

>>> for n in G:
...     print n,G.degree(n)
... 
1 1
{'fraction_non_alphanumeric': 0.22964867180805484, 'fraction_numerical': 0.03427592116538132, 'mean_word_length': 3.5984251968503935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 63, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '458511', 'n_tokens_mistral': 493, 'n_tokens_neox': 473, 'n_words': 112}