Exemple #1
0
        /// <summary>
        /// Creates nodes and edges from incidence matrix and add all elements to your canvas
        /// </summary>
        /// <param name="matrix">Incidence matrix</param>
        /// <param name="canvas">Canvas to draw</param>
        /// <returns>Tuple of nodes and edges</returns>
        public static Graph FromIncidenceToCanvas(int[,] matrix, Canvas canvas)
        {
            var tuple = FromIncidence(matrix);

            Node[] nodes = tuple.Nodes;
            Edge[] edges = tuple.Edges;
            GraphAction.AddRangeToCanvas(nodes, edges, canvas);
            return(tuple);
        }
Exemple #2
0
        /// <summary>
        /// Creates nodes and edges from adjacency matrix and add all elements to your canvas
        /// </summary>
        /// <param name="matrix">Adjacency matrix</param>
        /// <param name="canvas">Canvas to draw</param>
        /// <returns>Tuple of nodes and edges</returns>
        public static Graph FromAdjacencyToCanvas(int[,] matrix, Canvas canvas)
        {
            var items = FromAdjacency(matrix);

            Node[] nodes = items.Nodes;
            Edge[] edges = items.Edges;

            GraphAction.AddRangeToCanvas(nodes, edges, canvas);
            return(items);
        }