Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Link methods in functions to base Graph methods/properties #7125

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 20 additions & 4 deletions networkx/classes/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@


def nodes(G):
"""Returns an iterator over the graph nodes."""
"""Returns a NodeView over the graph nodes.

This function wraps the :func:`G.nodes <networkx.Graph.nodes>` property.
"""
return G.nodes()


Expand All @@ -59,29 +62,42 @@ def edges(G, nbunch=None):
Return all edges if nbunch is unspecified or nbunch=None.

For digraphs, edges=out_edges

This function wraps the :func:`G.edges <networkx.Graph.edges>` property.
"""
return G.edges(nbunch)


def degree(G, nbunch=None, weight=None):
"""Returns a degree view of single node or of nbunch of nodes.
If nbunch is omitted, then return degrees of *all* nodes.

This function wraps the :func:`G.degree <networkx.Graph.degree>` property.
"""
return G.degree(nbunch, weight)


def neighbors(G, n):
"""Returns a list of nodes connected to node n."""
"""Returns an iterator over all neighbors of node n.

This function wraps the :func:``G.neighbors <networkx.Graph.neighbors>` function.
"""
return G.neighbors(n)


def number_of_nodes(G):
"""Returns the number of nodes in the graph."""
"""Returns the number of nodes in the graph.

This function wraps the :func:`G.number_of_nodes <networkx.Graph.number_of_nodes>` function.
"""
return G.number_of_nodes()


def number_of_edges(G):
"""Returns the number of edges in the graph."""
"""Returns the number of edges in the graph.

This function wraps the :func:`G.number_of_edges <networkx.Graph.number_of_edges>` function.
"""
return G.number_of_edges()


Expand Down