Exemple #1
0
        /// <summary>
        /// Initializes a GraphDiagram with a specific id and custom comparer to be used by the data tracker.
        /// </summary>
        /// <param name="id">The id for the graph.</param>
        /// <param name="comparer">The comparer used by the data tracker (Dictionary object).</param>
        protected GraphDiagram(GraphId id, IEqualityComparer <T> comparer)
            : base(id, new Dictionary <NodeId, GraphNode <T, E> >(), new Dictionary <EdgeId, E>())
        {
            this.connected = new Dictionary <NodeId, ISet <EdgeId> >();

            if (null == comparer)
            {
                this.tracker = new Dictionary <T, ISet <NodeId> >();
            }
            else
            {
                this.tracker = new Dictionary <T, ISet <NodeId> >(comparer);
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a diagram.
        /// </summary>
        /// <param name="id">The specified graph id.</param>
        /// <param name="nodes">The initial set of nodes.</param>
        /// <param name="edges">The initial set of edges.</param>
        protected Diagram(GraphId id, IDictionary <NodeId, V> nodes, IDictionary <EdgeId, E> edges)
        {
            if (null == id)
            {
                throw new ArgumentNullException();
            }

            if (null == nodes)
            {
                throw new ArgumentNullException();
            }

            if (null == edges)
            {
                throw new ArgumentNullException();
            }

            this.id    = id;
            this.nodes = nodes;
            this.edges = edges;
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new unweighted graph with a specific id and custom comparer to be used by the data tracker.
 /// </summary>
 /// <param name="id">The id for the graph.</param>
 /// <param name="comparer">The comparer used by the data tracker (Dictionary object).</param>
 public Graph(GraphId id, IEqualityComparer <T> comparer)
     : base(id, comparer)
 {
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new unweighted graph with a specified id.
 /// </summary>
 /// <param name="id">The id used by the graph.</param>
 public Graph(GraphId id)
     : this(id, null)
 {
 }