Example #1
0
 /// <summary>
 ///  Adds a skill node to the graph. New nodes are automatically
 ///  connected to existing adjacent nodes.
 /// </summary>
 /// <param name="node">The skill node to be added.</param>
 /// <returns>The graph node that is added to the graph.</returns>
 public GraphNode AddNode(SkillNode node)
 {
     var graphNode = new GraphNode(node.Id);
     NodeDict.Add(node, graphNode);
     CheckLinks(node);
     return graphNode;
 }
Example #2
0
 /// <summary>
 /// Adds the given node to this node's neighbors.
 /// </summary>
 public void AddNeighbor(GraphNode other)
 {
     if (!_adjacent.Contains(other))
     {
         _adjacent.Add(other);
     }
 }
Example #3
0
 /// <summary>
 /// Merges the given GraphNode with this node. The collections of adjacent GraphNode are unioned (with neither
 /// this nor the other node contained in the collection). The other GraphNode's represented skill tree nodes
 /// and the given path between them are added to the represented nodes ones of this GraphNode.
 /// </summary>
 public void MergeWith(GraphNode other, IEnumerable<ushort> path)
 {
     _adjacent = _adjacent.Union(other._adjacent).Where(n => n != this && n != other).ToList();
     _nodes.AddRange(other._nodes);
     _nodes.AddRange(path);
     other._adjacent.Clear();
     other._nodes.Clear();
 }
Example #4
0
 public GraphNode SetStartNodes(IReadOnlyCollection<SkillNode> startNodes)
 {
     var supernode = new GraphNode(startNodes.Select(n => n.Id));
     foreach (var node in startNodes)
     {
         NodeDict.Add(node, supernode);
         CheckLinks(node);
     }
     return supernode;
 }
Example #5
0
 /// <summary>
 /// Returns true iff the given node is currently marked as a fixed or variable target node.
 /// </summary>
 public bool IsTarget(GraphNode n)
 {
     return _allTargetNodes.Contains(n);
 }
Example #6
0
 /// <summary>
 /// Returns true iff the given node is currently marked as a fixed target node.
 /// </summary>
 public bool IsFixedTarget(GraphNode n)
 {
     return _fixedTargetNodes.Contains(n);
 }