The GeneralVertexList object represents an indexed list of vertices which may be anything, and is often used in conjection with either SparseGraph, PySparseGraph or DenseGraph. The following example demonstrates its usage:
from apgl.graph import *
import numpy
numVertices = 10
numFeatures = 3
vList = GeneralVertexList(numVertices)
vList.setVertex(0, "abc")
vList.setVertex(1, "def")
This code creates a GeneralVertexList object, and assigns strings to the first and second vertices.
Bases: apgl.graph.AbstractVertexList.AbstractVertexList
Create an empty GeneralVertexList with the specified number of features for each vertex (initialised as None) and number of vertices.
| Parameters: | numVertices (int) – The number of vertices. |
|---|
Sets a vertex to None
| Parameters: | index (int) – the index of the vertex to assign a value. |
|---|
Returns a copy of this object.
Returns the number of vertices contained in this object.
Returns the value of a vertex.
| Parameters: | index (int) – the index of the vertex. |
|---|
Returns a list of vertices specified by vertexIndices, or all vertices if vertexIndices == None.
| Parameters: | vertexIndices (list) – a list of vertex indices. |
|---|---|
| Returns: | A set of vertices corresponding to the input indices. |
Load this object from filename.pkl.
| Parameters: | filename (str) – The name of the file to load. |
|---|
Save this object to filename.nvl.
| Parameters: | filename (str) – The name of the file to save to. |
|---|---|
| Returns: | The name of the saved file including extension. |
Set a vertex to the corresponding value.
| Parameters: |
|
|---|
Set the vertices to the given list of vertices. If indices = None then all vertices are replaced, and if not the given indices are used.
| Parameters: |
|
|---|
Returns a subset of this object, indicated by the given indices.