14.5.7 2部サブグラフの作成
グラフ・サーバー(PGX)を使用すると、クライアントは2部サブグラフを作成できます。次のメソッドは、作成されたBipartiteGraph
インスタンスを返します。
BipartiteGraph bipartiteSubGraphFromLeftSet(VertexSet<?> vertexSet)
BipartiteGraph bipartiteSubGraphFromLeftSet(VertexSet<?> vertexSet, String newGraphName)
BipartiteGraph bipartiteSubGraphFromLeftSet(Collection<VertexProperty<?, ?>> vertexProps, Collection<EdgeProperty<?>> edgeProps, VertexSet<?> vertexSet, String newGraphName)
BipartiteGraph bipartiteSubGraphFromLeftSet(Collection<VertexProperty<?, ?>> vertexProps, Collection<EdgeProperty<?>> edgeProps, VertexSet<?> vertexSet, String newGraphName, String isLeftPropName)
bipartite_sub_graph_from_left_set(self, vset, vertex_properties=True, edge_properties=True, name=None, is_left_name=None)
これらのメソッドには、追加の引数vertexSet
が必要です。これは一連の頂点(詳細は、コレクションとマップの使用を参照)を指し、その要素(頂点)には、結果の2部グラフの左側の頂点(つまり、右側の頂点へのエッジのみを持つ2部グラフの左側の頂点)が含まれます。
2部サブグラフを作成すると、PGXは追加のboolean
頂点プロパティisLeft
を自動的に挿入します。このプロパティの値は、2部サブグラフの左の頂点の場合はtrue
、右の頂点の場合はfalse
に設定されます。isLeft
頂点プロパティの名前は、返されるBipartiteGraph
オブジェクトに対してgetIsLeftPropertyAsync()
を使用して取得できます。
ユーザーは、任意で、新しく作成されたグラフの名前(newGraphName
)と、ブールの左頂点を示すプロパティのカスタム名(isLeftPropName
)を指定できます。ユーザーは、新しく作成したグラフ・インスタンスにコピーする頂点およびエッジ・プロパティを指定することもできます(vertexProps
およびedgeProps
)。
親トピック: グラフ変更とサブグラフ