graphit/graph_utils/graph_utilities.py
def graph_undirectional_to_directional(graph):
    """
    Convert a undirectional to a directional graph

    Returns a deep copy of the full graph with all undirectional edges
    duplicated as directional ones.

    In an undirectional edge the egde pair shares a single attribute
    dictionary. This dictionary gets duplicated to the unique directional
    edges.

    :param graph: Graph to convert
    :type graph:  :graphit:Graph

    :return:      Directional graph
    :rtype:       :graphit:Graph
    """

    if graph.directed:
        logging.info('Graph already configured as directed graph')

    graph_copy = graph.copy(deep=True)
    graph_copy.directed = True
    graph_copy.edges.clear()

    # copy directional edges in emptied edge store
    for edge, attr in graph.edges.items():
        graph_copy.add_edge(*edge, **attr)

    return graph_copy

    Convert a undirectional to a directional graph

    Returns a deep copy of the full graph with all undirectional edges
    duplicated as directional ones.

    In an undirectional edge the egde pair shares a single attribute
    dictionary. This dictionary gets duplicated to the unique directional
    edges.

    :param graph: Graph to convert
    :type graph:  :graphit:Graph

    :return:      Directional graph
    :rtype:       :graphit:Graph
    
Convert a undirectional to a directional graph
Returns a deep copy of the full graph with all undirectional edges
duplicated as directional ones.

In an undirectional edge the egde pair shares a single attribute
dictionary. This dictionary gets duplicated to the unique directional
edges.
Convert a undirectional to a directional graph Returns a deep copy of the full graph with all undirectional edges duplicated as directional ones . In an undirectional edge the egde pair shares a single attribute dictionary . This dictionary gets duplicated to the unique directional edges .
def graph_undirectional_to_directional(graph):
    if graph.directed:
        logging.info('Graph already configured as directed graph')
    graph_copy = graph.copy(deep=True)
    graph_copy.directed = True
    graph_copy.edges.clear()
    for edge, attr in graph.edges.items():
        graph_copy.add_edge(*edge, **attr)
    return graph_copy
def graph_undirectional_to_directional ( graph ) : if graph . directed : logging . info ( 'Graph already configured as directed graph' ) graph_copy = graph . copy ( deep = True ) graph_copy . directed = True graph_copy . edges . clear ( ) for edge , attr in graph . edges . items ( ) : graph_copy . add_edge ( * edge , ** attr ) return graph_copy
Convert a undirectional to a directional graph
Returns a deep copy of the full graph with all undirectional edges
duplicated as directional ones.
Convert a undirectional to a directional graph Returns a deep copy of the full graph with all undirectional edges duplicated as directional ones .
"""
    Convert a undirectional to a directional graph

    Returns a deep copy of the full graph with all undirectional edges
    duplicated as directional ones.

    In an undirectional edge the egde pair shares a single attribute
    dictionary. This dictionary gets duplicated to the unique directional
    edges.

    :param graph: Graph to convert
    :type graph:  :graphit:Graph

    :return:      Directional graph
    :rtype:       :graphit:Graph
    """ # copy directional edges in emptied edge store
None
:graphit:Graph
graph
Graph to convert
Graph to convert