27.5.4 Undirecting Graphs
Note:
Starting from Graph Server and Client Release 25.1, undirected graphs are deprecated.The following methods create the undirected version of a graph instance:
PgxGraph undirect()
PgxGraph undirect(String newGraphName)
PgxGraph undirect(MultiEdges multiEdges, SelfEdges selfEdges, TrivialVertices trivialVertices, Mode mode, String newGraphName)
PgxGraph undirect(Collection<VertexProperty<?, ?>> vertexProps, Collection<EdgeProperty<?>> edgeProps, MultiEdges multiEdges, SelfEdges selfEdges, Mode mode, String newGraphName)
undirect(self, vertex_properties=True, edge_properties=True, keep_multi_edges=True, keep_self_edges=True,
keep_trivial_vertices=True, in_place=False, name=None)
The first two methods create an
undirected version of the graph while copying all
of the vertex properties.
newGraphName
is an optional
argument to specify the name of the newly created
graph instance.
In contrast, the third and fourth methods concurrently perform undirecting and simplifying of a graph. See Simplifying and Copying Graphs for the meaning of each parameter.
All methods return an object of
the undirected PgxGraph
type.
An undirected graph has some
restrictions. Some algorithms are only supported
on directed graphs or are not yet supported for
undirected graphs. Further, PGX does not support
to store undirected graphs nor reading from
undirected formats. Since the edges do not have a
direction anymore, the behavior of
pgxEdge.getSource()
or
pgxEdge.getDestination()
can be
ambiguous. In order to provide deterministic
results, PGX will always return the vertex with
the smaller internal id as source and the other as
destination vertex.
Parent topic: Graph Mutation and Subgraphs