コード例 #1
0
 public EdgeOnPathFinder(
     Converter <NodeType, IEnumerable <EdgeType> > edgesOutOf,
     Converter <EdgeType, NodeType> targetOf,
     CanCreateNodeData <NodeType> data,
     IndexedProperty <EdgeType, bool> onPath,
     Predicate <NodeType> isSink)
 {
     this.edgesOutOf = edgesOutOf;
     this.targetOf   = targetOf;
     isBlocked       = data.CreateNodeData <bool>(false);
     blockedSources  = data.CreateNodeData <Set <NodeType> >(null);
     this.onPath     = onPath;
     this.isSink     = isSink;
 }
コード例 #2
0
        public IndexedGraphWrapper(ICollection <Node> nodes,
                                   Converter <Node, NodeInfo> infoOfNode, Converter <NodeInfo, ICollection <Node> > sourcesOfNode,
                                   IndexedProperty <Node, int> indexOfNode)
        {
            info               = new NodeInfo[nodes.Count];
            this.indexOfNode   = indexOfNode;
            this.sourcesOfNode = sourcesOfNode;
            //new IndexedProperty<Node,int>(new Dictionary<Node,int>());
            int i = 0;

            foreach (Node node in nodes)
            {
                info[i]           = infoOfNode(node);
                indexOfNode[node] = i;
                i++;
            }
            targetsOfNode = new ICollection <int> [info.Length];
        }