示例#1
0
文件: Edge.cs 项目: adamedx/shango
 public Edge(
     Vertex source,
     Vertex sink)
 {
     _source = source;
     _sink = sink;
 }
示例#2
0
文件: Edge.cs 项目: adamedx/shango
 public Edge(
     object sourceKey,
     object sinkKey)
 {
     _source = new Vertex( sourceKey );
     _sink = new Vertex( sinkKey );
 }
示例#3
0
        public virtual Edge GetEdge(
            Vertex source,
            Vertex sink)
        {
            Edge targetEdge = new Edge( source, sink );

            return (Edge) Edges.FindMatch( targetEdge );
        }
示例#4
0
        public virtual ArrayList GetEdgesTo(
            Vertex sink)
        {
            ArrayList edgesTo = new ArrayList();

            foreach ( Edge currentEdge in Edges )
            {
                if ( currentEdge.Sink == sink )
                {
                    edgesTo.Add( currentEdge );
                }
            }

            return edgesTo;
        }
示例#5
0
        public virtual ArrayList GetEdgesFrom(
            Vertex source)
        {
            ArrayList edgesFrom = new ArrayList();

            foreach ( Edge currentEdge in Edges )
            {
                if ( currentEdge.Source == source )
                {
                    edgesFrom.Add( currentEdge );
                }
            }

            return edgesFrom;
        }
示例#6
0
        public virtual Vertex GetVertex(
            object key)
        {
            Vertex targetVertex = new Vertex( key );

            return (Vertex) Vertices.FindMatch( targetVertex );
        }
示例#7
0
 public abstract Edge AddEdge(
     Vertex source,
     Vertex sink);
示例#8
0
 public abstract bool RemoveVertex(
     Vertex targetVertex);
示例#9
0
 public void AddNeighbor(Vertex neighbor, int weight)
 {
     _Neighbors.Add(new Neighbor(neighbor, weight));
 }