예제 #1
0
 public GraphLayout()
 {
     if (DesignerProperties.GetIsInDesignMode(this))
     {
         var g        = new BidirectionalWeightedGraph <object, WeightedEdge <object> >();
         var vertices = new object[] { "S", "A", "M", "P", "L", "E" };
         var edges    = new WeightedEdge <object>[] {
             new WeightedEdge <object>(vertices[0], vertices[1]),
             new WeightedEdge <object>(vertices[1], vertices[2]),
             new WeightedEdge <object>(vertices[1], vertices[3]),
             new WeightedEdge <object>(vertices[3], vertices[4]),
             new WeightedEdge <object>(vertices[0], vertices[4]),
             new WeightedEdge <object>(vertices[4], vertices[5])
         };
         g.AddVerticesAndEdgeRange(edges);
         OverlapRemovalAlgorithmType = "FSA";
         LayoutAlgorithmType         = "FR";
         Graph = g;
     }
 }
예제 #2
0
파일: Tests.cs 프로젝트: mitxael/SSHIVA
        public void Setup()
        {
            G = new BidirectionalWeightedGraph <object, WeightedEdge <object> >();

            Assert.IsNotNull(G);
        }
예제 #3
0
        public GraphView(ref GraphManager G, ref BidirectionalWeightedGraph <object, WeightedEdge <object> > graph)
        {
            /// ASSIGN graph to viewer
            GraphFromLibrary = G;
            GraphToVisualize = graph;

            InitializeComponent();

            /// Customize layout
            SetCustomLayout(GraphFromLibrary.V, GraphFromLibrary.E);
            MainWindow.graphLayout = graphLayout;

            /// Set background
            //this.Background = new SolidColorBrush( (Color)Application.Current.Resources["GraphBackground"] );
            //GraphZoom.Background = new SolidColorBrush( (Color)Application.Current.Resources["GraphBackground"] );
            ImageBrush Brushes_Background = new ImageBrush();

            Brushes_Background.ImageSource = new BitmapImage(new Uri("pack://application:,,,/" + Assembly.GetExecutingAssembly().GetName().Name + ";component/Resources/graph_bg.jpg"));
            GraphZoom.Background           = Brushes_Background;
            //graphLayout.Background = new SolidColorBrush( (Color)Application.Current.Resources["GraphBackground"] );
            graphLayout.Background = Brushes.Transparent;

            /// Clear HighlightedEdges
            MainWindow.HighlightedEdges.Clear();
            MainWindow.HighlightedVertices.Clear();

            /// SET graph information
            if (GraphFromLibrary.source != "")
            {
                string gsource = GraphFromLibrary.source.Remove(0, 6);     // remove "input_"
                LabelInfo_1B.Content = gsource.Remove(gsource.Length - 4); // remove ".txt

                LabelInfo_2B.Content = GraphFromLibrary.V;
                LabelInfo_3B.Content = GraphFromLibrary.E;
                LabelInfo_4B.Content = Math.Round(GraphFromLibrary.Density, 3);
                LabelInfo_5B.Content = GraphFromLibrary.Degeneracy;
                LabelInfo_6B.Content = GraphFromLibrary.Cyclomatic;
                LabelInfo_7B.Content = GraphFromLibrary.Components;
            }

            /// SHOW rendering algorithms
            ///{ "CompoundFDP", "BoundedFR", "FR", "LinLog", "KK", "Circular", "Tree", "ISOM", "EfficientSugiyama" };
            IEnumerable <string> RenderingAlgorithms = new string[] { "CompoundFDP", "BoundedFR", "LinLog", "KK", "Circular", "Tree", "ISOM" };

            foreach (string algo in RenderingAlgorithms)
            {
                this.ComboAlgorithm.Items.Add(algo);
            }
            this.ComboAlgorithm.SelectedIndex = 3;

            /// SHOW cycles and cliques (if available)
            this.BtnCycles.Visibility  = (GraphFromLibrary.minimumCycleBasis != null && GraphFromLibrary.minimumCycleBasis.Length > 0)? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
            this.BtnCliques.Visibility = (GraphFromLibrary.maximalCliqueSet != null && GraphFromLibrary.maximalCliqueSet.Length > 0)? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;

            /// SHOW persistent homology (ifavailable)
            this.BtnBetti.Visibility      = (GraphFromLibrary.PH_barcodes != null && GraphFromLibrary.PH_barcodes.Count > 0)? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
            this.BtnDiagram.Visibility    = (GraphFromLibrary.PH_barcodes != null && GraphFromLibrary.PH_barcodes.Count > 0)? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
            this.BtnBottleneck.Visibility = (GraphFromLibrary.PH_barcodes != null && GraphFromLibrary.PH_barcodes.Count > 0)? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
            this.BtnFiltration.Visibility = (GraphFromLibrary.PH_barcodes != null && GraphFromLibrary.PH_barcodes.Count > 0)? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;

            /// Windows size depends on displayed vertices
            //this.WindowState = (G.V<10)? WindowState.Normal : WindowState.Maximized;
            this.WindowState = WindowState.Maximized;
        }