コード例 #1
0
		/// <summary>
		/// A height first search algorithm on a directed graph
		/// </summary>
		/// <param name="g">The graph to traverse</param>
		/// <exception cref="ArgumentNullException">g is null</exception>
		public HeightFirstSearchAlgorithm(IBidirectionalVertexListGraph g)
		{
			if (g == null)
				throw new ArgumentNullException("g");
			this.visitedGraph = g;
			this.colors = new VertexColorDictionary();
		}
コード例 #2
0
 public PageRankAlgorithm(IBidirectionalVertexListGraph visitedGraph)
 {
     if (visitedGraph == null)
     {
         throw new ArgumentNullException("visitedGraph");
     }
     this.visitedGraph = visitedGraph;
 }
コード例 #3
0
ファイル: PageRankAlgorithm.cs プロジェクト: tmauldin/mb-unit
 /// <summary>
 /// Creates a PageRank algorithm around the visited graph
 /// </summary>
 /// <param name="visitedGraph">
 /// Visited <see cref="IBidirectionalVertexListGraph"/> instance.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <param name="visitedGraph"/> is a null reference (Nothing in Visual Basic).
 /// </exception>
 public PageRankAlgorithm(IBidirectionalVertexListGraph visitedGraph)
 {
     if (visitedGraph == null)
     {
         throw new ArgumentNullException("visitedGraph");
     }
     this.visitedGraph = visitedGraph;
 }
コード例 #4
0
 /// <summary>
 /// A height first search algorithm on a directed graph
 /// </summary>
 /// <param name="g">The graph to traverse</param>
 /// <exception cref="ArgumentNullException">g is null</exception>
 public HeightFirstSearchAlgorithm(IBidirectionalVertexListGraph g)
 {
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     this.visitedGraph = g;
     this.colors       = new VertexColorDictionary();
 }
 public NeighborDepthFirstSearchAlgorithm(IBidirectionalVertexListGraph g)
 {
     this.maxDepth = 0x7fffffff;
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     this.visitedGraph = g;
     this.colors = new VertexColorDictionary();
 }
コード例 #6
0
ファイル: AlgoUtility.cs プロジェクト: tmauldin/mb-unit
        /// <summary>
        /// Returns an enumerable collection of the root vertices of the graph
        /// </summary>
        /// <param name="g">graph to visit</param>
        /// <returns>enumerable of root vertices</returns>
        /// <remarks>
        /// <para>
        /// Thread safe.
        /// </para>
        /// </remarks>
        public static IVertexEnumerable Sources(
            IBidirectionalVertexListGraph g
            )
        {
            SourceVertexPredicate root = new SourceVertexPredicate(g);

            return(new FilteredVertexEnumerable(
                       g.Vertices,
                       root
                       ));
        }
コード例 #7
0
		/// <summary>
		/// A depth first search algorithm on a directed graph
		/// </summary>
		/// <param name="g">The graph to traverse</param>
		/// <param name="colors">vertex color map</param>
		/// <exception cref="ArgumentNullException">g or colors are null</exception>
		public NeighborDepthFirstSearchAlgorithm(
			IBidirectionalVertexListGraph g, 
			VertexColorDictionary colors
			)
		{
			if (g == null)
				throw new ArgumentNullException("g");
			if (colors == null)
				throw new ArgumentNullException("Colors");

			this.visitedGraph = g;
			this.colors = colors;
		}
コード例 #8
0
 public HeightFirstSearchAlgorithm(IBidirectionalVertexListGraph g, VertexColorDictionary colors)
 {
     this.maxDepth = 0x7fffffff;
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     if (colors == null)
     {
         throw new ArgumentNullException("Colors");
     }
     this.visitedGraph = g;
     this.colors = colors;
 }
コード例 #9
0
        /// <summary>
        /// A depth first search algorithm on a directed graph
        /// </summary>
        /// <param name="g">The graph to traverse</param>
        /// <param name="colors">vertex color map</param>
        /// <exception cref="ArgumentNullException">g or colors are null</exception>
        public NeighborDepthFirstSearchAlgorithm(
            IBidirectionalVertexListGraph g,
            VertexColorDictionary colors
            )
        {
            if (g == null)
            {
                throw new ArgumentNullException("g");
            }
            if (colors == null)
            {
                throw new ArgumentNullException("Colors");
            }

            this.visitedGraph = g;
            this.colors       = colors;
        }
コード例 #10
0
ファイル: AlgoUtility.cs プロジェクト: timonela/mb-unit
		/// <summary>
		/// Returns an enumerable collection of the root vertices of the graph
		/// </summary>
		/// <param name="g">graph to visit</param>
		/// <returns>enumerable of root vertices</returns>
		/// <remarks>
		/// <para>
		/// Thread safe.
		/// </para>
		/// </remarks>
		public static IVertexEnumerable Sources(
			IBidirectionalVertexListGraph g
			)
		{
			SourceVertexPredicate root = new SourceVertexPredicate(g);
			return new FilteredVertexEnumerable(
				g.Vertices,
				root
				);
		}