7.1.1.4.1.6. cobramod.visualization.mapping¶
Mapping of graph
This modules handles the mapping of a directed graph into a matrix that can be
used in Escher. The main function is
cobramod.visualization.mapping.get_mapping(), which checks if the graph
is lineal and creates the representation in a matrix. In case of cyclic path,
it will cut it.
7.1.1.4.1.6.1. Functions¶
|
Returns the mapping for the given graph. The mapping is defined as a list |
|
Return a set with the all the values for a given list of keys. Elements of |
|
Returns the relation parent: children as a dictionary. A key represent the |
|
Return index of item in a path, whose value is found. |
|
Returns an unformatted matrix from a graph. The matrix represent the |
|
Fills each row of the matrix with 0 until it reaches given length |
|
Formats given matrix and returns, if possible, a reduced matrix. Matrix |
|
Returns a matrix for the representation of given graph. |
|
Returns a transpose matrix for given matrix. |
7.1.1.4.1.6.2. Module Contents¶
- cobramod.visualization.mapping.get_graph_dict(graph)¶
Returns the mapping for the given graph. The mapping is defined as a list with a “core” path and its branches. Cyclic graphs will be cut to create a lineal direct graph
Note
If the first element of a branch is not in the “core”, then it is in one of the branches.
- cobramod.visualization.mapping.get_all_values(dictionary, keys)¶
Return a set with the all the values for a given list of keys. Elements of tuples will be added separately.
- cobramod.visualization.mapping.child_map(mapping, dictionary)¶
Returns the relation parent: children as a dictionary. A key represent the parent and the key their corresponding children
- cobramod.visualization.mapping.get_index(dictionary, path, value)¶
Return index of item in a path, whose value is found.
- cobramod.visualization.mapping.unformatted_matrix(graph)¶
Returns an unformatted matrix from a graph. The matrix represent the locations of the nodes and their relationships. Graph will be cut if cyclic. Unrelated nodes will be appended separately at the end. The matrix have 0 in empty positions.
- Parameters:
graph (dict) – Dictionary with relationship between nodes. A node can have multiple edges, which should be presented as values.
- Return type:
List[list]
- Returns
List[list]: Representation of matrix
- cobramod.visualization.mapping.fill_matrix(matrix, length)¶
Fills each row of the matrix with 0 until it reaches given length
- cobramod.visualization.mapping.format_matrix(matrix, max_length)¶
Formats given matrix and returns, if possible, a reduced matrix. Matrix will be filled with 0’s if needed.
- cobramod.visualization.mapping.get_mapping(graph)¶
Returns a matrix for the representation of given graph.
- Parameters:
graph (dict) – Dictionary with relationship between nodes. A node can have multiple edges, which should be presented as values.
- Return type:
List[list]
- Returns
List[list]: Representation of matrix