Interface IGraphEnvironment<TEdge, TNode>
Assembly: Mars.Interfaces.dll
Syntax
public interface IGraphEnvironment<TEdge, TNode> : IEnvironment, IModelObject
Type Parameters
Name |
Description |
TEdge |
|
TNode |
|
Properties
Edges
Set of all nodes in the graph
Declaration
IDictionary<int, TEdge> Edges { get; }
Property Value
Type |
Description |
IDictionary<System.Int32, TEdge> |
|
Nodes
Set of all nodes in the graph
Declaration
ICollection<TNode> Nodes { get; }
Property Value
Type |
Description |
ICollection<TNode> |
|
NodesMap
Gets the mapping of each node index to their concrete node instance.
Declaration
IDictionary<int, TNode> NodesMap { get; }
Property Value
Type |
Description |
IDictionary<System.Int32, TNode> |
|
Methods
AddEdge(TNode, TNode, IDictionary<String, Object>)
Create a new edge and add references in the affected nodes
Declaration
TEdge AddEdge(TNode origin, TNode destination, IDictionary<string, object> attributes = null)
Parameters
Type |
Name |
Description |
TNode |
origin |
the node where the edge starts |
TNode |
destination |
the node where the edge ends |
IDictionary<System.String, System.Object> |
attributes |
All associated data to this edge e.g., the amount of lanes the length or maximum speed constraints.
|
Returns
Type |
Description |
TEdge |
the newly created edge |
AddNode(IDictionary<String, Object>)
Create a new node and add it to the set of nodes
Declaration
TNode AddNode(IDictionary<string, object> attributes = null)
Parameters
Type |
Name |
Description |
IDictionary<System.String, System.Object> |
attributes |
All associated data to this edge e.g., the amount of lanes the length or maximum speed constraints.
|
Returns
Type |
Description |
TNode |
the newly created node |
GetRandomNode()
Returns a random selected nod of this environment. Often be helpful
for testing purposes.
Declaration
Returns
Type |
Description |
TNode |
Returns a concrete |
NearestNodesByHops(TNode, Int32)
Get all nodes within the range of x hops
Declaration
List<ISpatialNode> NearestNodesByHops(TNode node, int hops)
Parameters
Type |
Name |
Description |
TNode |
node |
node where the search starts |
System.Int32 |
hops |
number of hops |
Returns
RemoveEdge(TEdge)
Remove an edge and all references to it from the affected nodes
Declaration
bool RemoveEdge(TEdge edge)
Parameters
Type |
Name |
Description |
TEdge |
edge |
the edge to be removed |
Returns
Type |
Description |
System.Boolean |
true if the edge could be removed
false if the removal failed
|
RemoveNode(TNode)
Remove a node and delete all edges which are affected by this change
Declaration
bool RemoveNode(TNode node)
Parameters
Type |
Name |
Description |
TNode |
node |
the node to be deleted |
Returns
Type |
Description |
System.Boolean |
true if the node could be deleted
false if the node couldn't be deleted
|