Esempio n. 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="edge"></param>
 /// <param name="graphNode"></param>
 public void AddGraphNode(Edge edge, int parentGraphNodeId, GraphNode graphNode)
 {
     GraphNode parent = GetGraphNodeById(parentGraphNodeId);
     edge.StartGraphNodeId = parentGraphNodeId;
     edge.EndGraphNodeId = graphNode.GraphNodeId;
     EdgeCollection.Add(edge);
 }
Esempio n. 2
0
 public GraphNode GetGraphNodeParent(int graphNodeId)
 {
     GraphNode foundNode = new GraphNode();
     int end = 0;
     //int start = 0;
     for (int i = 0; i < GraphNodeCollection.Count; i++)
     {
         if (GraphNodeCollection[i].ParentId == graphNodeId)
         {
             return GraphNodeCollection[i];
         }
         else
         {
             if (GraphNodeCollection[i].Edges.Count > 0)
             {
                 for (int j = 0; j < GraphNodeCollection[i].Edges.Count; j++)
                 {
                     end = GraphNodeCollection[i].Edges[j].StartGraphNodeId;
                     if (end == graphNodeId)
                     {
                         return GetGraphNodeById(GraphNodeCollection[i].Edges[j].StartGraphNodeId);
                     }
                     else
                     {
                         FindGraphNode(graphNodeId, GetGraphNodeById(GraphNodeCollection[i].Edges[j].StartGraphNodeId));
                     }
                 }
             }
         }
     }
     return foundNode;
 }
Esempio n. 3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="edge"></param>
 /// <param name="graphNode"></param>
 /// <param name="graphNodeFoUpdate"></param>
 public void UpdateGraphNode(Edge edge, Edge edgeForUpadate, GraphNode graphNode, GraphNode graphNodeForUpdate)
 {
     graphNodeForUpdate = graphNode;
     edgeForUpadate = edge;
 }
Esempio n. 4
0
 public GraphNode GetGraphNodeById(int id)
 {
     GraphNode node = new GraphNode();
     for (int i = 0; i < GraphNodeCollection.Count; i++)
     {
         if (id == GraphNodeCollection[i].GraphNodeId)
             return GraphNodeCollection[i];
     }
     return node;
 }