14.5.3 Transposing Graphs
You can create a transposed version of the graph.
Transpoing a Graph Using Java
PgxGraph transpose(Collection<VertexProperty<?, ?>> vertexProps, Collection<EdgeProperty<?>> edgeProps, Map<String, String> edgeLabelMapping, Mode mode, String newGraphName)
Transpoing a Graph Using Python
transpose(self, vertex_properties=True, edge_properties=True, edge_label_mapping=None, in_place=False, name=None)
The edgeLabelMapping
argument can be used to rename edge labels. If any key in the given map does not exist as an edge label, it will be ignored.
edgeLabelMapping
argument can also be an empty Map or null.
null
: if argument isnull
, edge labels from source graph will be removed on transposed graph. (default behavior when using convenience methods).empty Map
: if argument is an empty Map, edge labels from source graph will be neither removed or renamed. Instead, it will be kept as it is in source graph.
See Simplifying and Copying Graphs for the meaning of the other parameters.
Additionally, the graph server (PGX) provides the following convenience methods from the PgxGraph
class for the common operation of copying all vertex and edge properties into the transposed graph instance:
Parent topic: Graph Mutation and Subgraphs