graphit/graph_algorithms.py
def node_neighbors(graph, nid):
    """
    Return de neighbor nodes of the node.
    
    This method is not hierarchical and thus the root node has no effect.
    
    Directed graphs and/or masked behaviour: masked nodes or directed
    nodes not having an edge from source to node will not be returned.
    
    :param graph: Graph to query
    :type graph:  Graph class instance
    :param nid:   node ID to return neighbors for
    :type nid:    :py:int
    """
    
    if nid is None:
        return []
    
    if graph.masked:
        nodes = set(graph.nodes.keys())
        adjacency = set(graph.adjacency[nid])
    else:
        nodes = set(graph.origin.nodes.keys())
        adjacency = set(graph.origin.adjacency[nid])

    return sorted(nodes.intersection(adjacency))

    Return de neighbor nodes of the node.
    
    This method is not hierarchical and thus the root node has no effect.
    
    Directed graphs and/or masked behaviour: masked nodes or directed
    nodes not having an edge from source to node will not be returned.
    
    :param graph: Graph to query
    :type graph:  Graph class instance
    :param nid:   node ID to return neighbors for
    :type nid:    :py:int
    
Return de neighbor nodes of the node.
This method is not hierarchical and thus the root node has no effect.

Directed graphs and/or masked behaviour: masked nodes or directed
nodes not having an edge from source to node will not be returned.
Return de neighbor nodes of the node . This method is not hierarchical and thus the root node has no effect . Directed graphs and / or masked behaviour : masked nodes or directed nodes not having an edge from source to node will not be returned .
def node_neighbors(graph, nid):
    if nid is None:
        return []
    if graph.masked:
        nodes = set(graph.nodes.keys())
        adjacency = set(graph.adjacency[nid])
    else:
        nodes = set(graph.origin.nodes.keys())
        adjacency = set(graph.origin.adjacency[nid])
    return sorted(nodes.intersection(adjacency))
def node_neighbors ( graph , nid ) : if nid is None : return [ ] if graph . masked : nodes = set ( graph . nodes . keys ( ) ) adjacency = set ( graph . adjacency [ nid ] ) else : nodes = set ( graph . origin . nodes . keys ( ) ) adjacency = set ( graph . origin . adjacency [ nid ] ) return sorted ( nodes . intersection ( adjacency ) )
Return de neighbor nodes of the node.
Return de neighbor nodes of the node .
"""
    Return de neighbor nodes of the node.
    
    This method is not hierarchical and thus the root node has no effect.
    
    Directed graphs and/or masked behaviour: masked nodes or directed
    nodes not having an edge from source to node will not be returned.
    
    :param graph: Graph to query
    :type graph:  Graph class instance
    :param nid:   node ID to return neighbors for
    :type nid:    :py:int
    """
graph
Graph to query
Graph to query
nid
node ID to return neighbors for
node ID to return neighbors for