Class Graph
Represents a undirected graph.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public class Graph : IDisposable
Constructors
Graph(MemoryMap, GraphProfile, Int32, Int64)
Creates a new using the given file.
Declaration
public Graph(MemoryMap map, GraphProfile profile, int edgeDataSize, long estimatedSize)
Parameters
|
MemoryMap
map
|
|
GraphProfile
profile
|
|
System.Int32
edgeDataSize
|
|
System.Int64
estimatedSize
|
Graph(MemoryMap, Int32, Int64)
Creates a new using the given file.
Declaration
public Graph(MemoryMap map, int edgeDataSize, long estimatedSize)
Parameters
|
MemoryMap
map
|
|
System.Int32
edgeDataSize
|
|
System.Int64
estimatedSize
|
Graph(Int32)
Creates a new graph.
Declaration
public Graph(int edgeDataSize)
Parameters
|
System.Int32
edgeDataSize
|
Graph(Int32, Int64)
Creates a new graph.
Declaration
public Graph(int edgeDataSize, long sizeEstimate)
Parameters
|
System.Int32
edgeDataSize
|
|
System.Int64
sizeEstimate
|
Properties
EdgeCapacity
Returns the capacity for edges.
Declaration
public long EdgeCapacity { get; }
Property Value
|
System.Int64
|
EdgeCount
Returns the number of edges in this graph.
Declaration
public long EdgeCount { get; }
Property Value
|
System.Int64
|
IsSimple
Returns true if this graph is simple (max one edge between any two vertices).
Declaration
public bool IsSimple { get; }
Property Value
|
System.Boolean
|
SizeInBytes
Returns the size in bytes as if serialized.
Declaration
public long SizeInBytes { get; }
Property Value
|
System.Int64
|
VertexCapacity
Returns the capacity for vertices.
Declaration
public long VertexCapacity { get; }
Property Value
|
System.Int64
|
VertexCount
Returns the number of vertices in this graph.
Declaration
public uint VertexCount { get; }
Property Value
|
System.UInt32
|
Methods
AddEdge(UInt32, UInt32, UInt32[])
Adds an edge with the associated data.
Declaration
public uint AddEdge(uint vertex1, uint vertex2, params uint[] data)
Parameters
|
System.UInt32
vertex1
|
|
System.UInt32
vertex2
|
|
System.UInt32[]
data
|
Returns
|
System.UInt32
|
AddVertex(UInt32)
Adds a new vertex.
Declaration
public void AddVertex(uint vertex)
Parameters
|
System.UInt32
vertex
|
Compress()
Relocates data internally in the most compact way possible.
Declaration
public void Compress()
Compress(Action<UInt32, UInt32>)
Relocates data internally in the most compact way possible.
Declaration
public void Compress(Action<uint, uint> updateEdgeId)
Parameters
|
Action<System.UInt32, System.UInt32>
updateEdgeId
The edge id's may change. This action can be used to hook into every change. |
Deserialize(Stream, GraphProfile)
Deserializes a graph from the given stream.
Declaration
public static Graph Deserialize(Stream stream, GraphProfile profile)
Parameters
|
System.IO.Stream
stream
|
|
GraphProfile
profile
|
Returns
|
Graph
|
Dispose()
Disposes of all native resources associated with this memory dynamic graph.
Declaration
public void Dispose()
GetEdge(UInt32)
Returns the edge with the given id.
Declaration
public Edge GetEdge(uint edgeId)
Parameters
|
System.UInt32
edgeId
|
Returns
|
Edge
|
GetEdgeEnumerator()
Returns an empty edge enumerator.
Declaration
public Graph.EdgeEnumerator GetEdgeEnumerator()
Returns
|
Graph.EdgeEnumerator
|
GetEdgeEnumerator(UInt32)
Returns all edges starting at the given vertex.
Declaration
public Graph.EdgeEnumerator GetEdgeEnumerator(uint vertex)
Parameters
|
System.UInt32
vertex
|
Returns
|
Graph.EdgeEnumerator
|
HasVertex(UInt32)
Returns true if this graph has the given vertex.
Declaration
public bool HasVertex(uint vertex)
Parameters
|
System.UInt32
vertex
|
Returns
|
System.Boolean
|
MarkAsMulti()
Marks this graph as a multigraph, from now on duplicate edges are allowed.
Declaration
public void MarkAsMulti()
MarkAsSimple()
Verifies if this graph is simple and marks it as such.
Declaration
public bool MarkAsSimple()
Returns
|
System.Boolean
|
Remarks
- Checks for duplicate edges, returns false if it still finds one.
- Marks this graph as simple if the checks succeed.
RemoveEdge(UInt32)
Deletes the edge with the given id.
Declaration
public bool RemoveEdge(uint edgeId)
Parameters
|
System.UInt32
edgeId
|
Returns
|
System.Boolean
|
RemoveEdges(UInt32)
Deletes all edges leading from/to the given vertex.
Declaration
public int RemoveEdges(uint vertex)
Parameters
|
System.UInt32
vertex
|
Returns
|
System.Int32
|
RemoveEdges(UInt32, UInt32)
Deletes the edge between the two given vertices.
Declaration
public int RemoveEdges(uint vertex1, uint vertex2)
Parameters
|
System.UInt32
vertex1
|
|
System.UInt32
vertex2
|
Returns
|
System.Int32
|
RemoveVertex(UInt32)
Removes the given vertex.
Declaration
public bool RemoveVertex(uint vertex)
Parameters
|
System.UInt32
vertex
|
Returns
|
System.Boolean
|
Serialize(Stream)
Serializes this graph to disk.
Declaration
public long Serialize(Stream stream)
Parameters
|
System.IO.Stream
stream
|
Returns
|
System.Int64
|
Sort(ArrayBase<UInt32>)
Sorts the graph based on the given transformations.
Declaration
public void Sort(ArrayBase<uint> transformations)
Parameters
|
ArrayBase<System.UInt32>
transformations
|
Switch(UInt32, UInt32)
Switches the two vertices.
Declaration
public void Switch(uint vertex1, uint vertex2)
Parameters
|
System.UInt32
vertex1
|
|
System.UInt32
vertex2
|
Trim()
Resizes the internal data structures to their smallest size possible.
Declaration
public void Trim()
UpdateEdgeData(UInt32, UInt32[])
Updates the data associated with this edge.
Declaration
public void UpdateEdgeData(uint edgeId, params uint[] data)
Parameters
|
System.UInt32
edgeId
|
|
System.UInt32[]
data
|