Giter Club home page Giter Club logo

graphx's Introduction

GraphX for .NET

Build statusGraphX

Introduction

GraphX for .NET is an advanced open-source graph layout and visualization library that supports different layout algorithms and provides many means for visual customizations It is capable of rendering large amount of vertices and steadily moves to support the most popular .NET platforms. GraphX already served well as the foundation for many other projects where its functionality was irreplaceable.

Requirements

GraphX requires Visual Studio 2019 Comunity Edition or above to build manually. QuikGraph nuget project is required for GraphX to operate. Also it is worth noting that it uses partial code from: Graph#, WPFExtensions, NodeXL, Extended WPF Toolkit, YAXLib and ModernUI.

Platform Support

Our library supports following platforms:

  • Windows Desktop (.NET Core/WPF/WinForms on Windows 7+ using .NET4.6.1+ or .NET Core 3.1)
  • Universal Windows Platform (UWP or UAP) on Windows 10
  • Xamarin/Uno (WIP, only logic core is available)

Features

  • GraphX is a performance oriented library coded with modular design in mind optimized for:

    • Large amount of templated graph vertices rendering
    • Isolated visual and logic libraries design and modular coding approach for better extensibility
    • Constantly improving MVVM support
    • .NET multiplatform support
    • Multiple layout algorithms ( FR, KK, ISOM, LinLog, Simple Tree, Simple Circle, Sugiyama, CompoundFDP, FSA/FSAOneWay overlap removal) and for grouped graph layout algorithm
  • In general it can do almost everything you need to layout and display any graph you want, in particular it provide following features:

    • Ability to create and plug-in custom external layout, overlap removal and edge routing algorithms
    • Enhanced edge pointer customization capabilities allowing to easily create and apply custom edge pointers
    • Customizable control highlighting using behaviour logic
    • Graph printing methods for Windows Desktop platform
    • Vertex and edge move, delete, add, mouse over animation support with the ability to create custom animations!
    • Universal graph serialization methods implemented by shared interface allows custom serialization to be applied on different platforms
    • Graph state saving and loading allows the capture and store in-memory visual and data graphs
    • Async algorithm computation support
    • Rich usability documentation and sample projects
  • It supports following edge related features:

    • Support for parameterized edge routing algorithms (SimpleER, EdgeBundling, PathFinder)
    • Support for dynamic and/or single edge routing calculation (for ex. for dragged vertex)
    • Edges curving (smoothing) technique that can be applied to any ER algorithm
    • Dynamic templated edge labels with edge alignment support
    • Easy templating including dashed edges of several types
    • Optional self-looped edges visualization support
    • Optional parallel edges visualization support between vertices
  • Advanced graph vertex features are as follows:

    • Easy vertex drag and highlight support including on-the-fly edge routing updates
    • Filtering feature provides selective vertex rendering leaving supplied graph untouched
    • Customizable vertex labels support that allows to set text, position and angle
    • Support for different vertex math shapes for proper edge connections rendering
    • Support for different vertex and edge animations including the ability to easily create custom animations
    • Vertex connection points (VCP) allows to implement customizable edge-to-vertex connections
    • Vertex snap-to-grid feature while dragging vertex or group of vertices
  • And at last some additional features to note:

    • Built in enchanced zoom control with minimap and zooming features:
      • Support for area selection of the vertices
      • Support for area zooming and smooth animations
    • Design-time visual preview for all controls
    • Many well commented example projects

graphx's People

Contributors

birbilis avatar bleibold avatar devangsinh avatar edgardozoppi avatar galakt avatar jorgensigvardsson avatar kernelith avatar panthernet avatar perturbare avatar rachelterry avatar tzneal avatar xe7485 avatar xen2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphx's Issues

Blank GraphArea and how to troubleshoot

NOTE: I tried registering on the PantherNet forums and no email was sent within 3-4 hours.

I'm making a WPF MVVM app using Prism and I cannot seem to get the graph to show up. I'm loading the file from a GraphML and want to keep the Vertex positions frozen in place, so I don't want to do the layout.

If I run stuff in break mode, I have the Graph being wired back to the GraphArea component - but things like Height/Width are NaN, the ZoomControl doesn't show anything, and I can't get any other info out of the DLLs to Try/Catch anything.

I'm fairly certain I've inherited everything correctly, but I need to know what specifically to check to make sure that rendering is actually happening.

RhythmView.xaml

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mvvm="http://prismlibrary.com/"
             xmlns:local="clr-namespace:BronzeHeron.Graph.Rhythm.Views"                                                                                                                                       
             xmlns:graphx="clr-namespace:GraphX;assembly=GraphX.WPF.Controls"
             xmlns:controls="http://schemas.panthernet.ru/graphx/"
             xmlns:ugraph="clr-namespace:BronzeHeron.Graph.Rhythm.Controls"
             x:Class="BronzeHeron.Graph.Rhythm.Views.RhythmView"
             mc:Ignorable="d"
             mvvm:ViewModelLocator.AutoWireViewModel="True"
             d:DesignHeight="300" d:DesignWidth="1920">
    <TabControl>
        <TabItem Header="Rhythm1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="9*"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                </Grid.RowDefinitions>
                <controls:ZoomControl x:Name="ZoomControl1" Margin="0" MaxWidth="1024" Grid.Row="0">
                    <ugraph:RhythmGraphArea x:Name="Rga1" Margin="-435,10,-1459,-220" Initialized="Graph_Initialised" />
                </controls:ZoomControl>
                <Button x:Name="CmdLoad" Width="100" Content="Load Graph" Grid.Row="1"/>
            </Grid>
        </TabItem>
    </TabControl>
</UserControl>

RhythmView.xaml.cs

    public partial class RhythmView : UserControl {
        public RhythmView() {
            InitializeComponent();

            Rga1 = ((dynamic)this.DataContext).RhythmGraphArea;
            Rga1.GenerateGraph();
        }

        private void Graph_Initialised(object sender, EventArgs e) {
            Debug.WriteLine($"Sender: {sender} EventArgs: {e}");
        }
    }

RhythmViewModel.cs

public RhythmViewModel() {
	RhythmGraphArea = new RhythmGraphArea();
	var g = new BidirectionalGraph<RhythmVertex, RhythmEdge>();
	using (var ot = new StringReader(Resources.DefaultRhythmGraph))
	using (var xreader = XmlReader.Create(ot)) {
		g.DeserializeFromGraphML(xreader,
			id => new RhythmVertex(int.Parse(id)),
			(source, target, id) => new RhythmEdge(source, target) {
				ID = int.Parse(id)
			});
		GraphData = g;
	}
	RhythmLogicCore = new GxLogicCoreRhythm {
		Graph = GraphData,
		DefaultLayoutAlgorithm = LayoutAlgorithmTypeEnum.KK,
		DefaultOverlapRemovalAlgorithm = OverlapRemovalAlgorithmTypeEnum.FSA,
		DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.SimpleER,
		AsyncAlgorithmCompute = false
	};

	((KKLayoutParameters)RhythmLogicCore.DefaultLayoutAlgorithmParams).MaxIterations = 100;

	RhythmLogicCore.DefaultLayoutAlgorithmParams =
					RhythmLogicCore.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.KK);
	RhythmLogicCore.DefaultOverlapRemovalAlgorithmParams =
			RhythmLogicCore.AlgorithmFactory.CreateOverlapRemovalParameters(OverlapRemovalAlgorithmTypeEnum.FSA);
	((OverlapRemovalParameters)RhythmLogicCore.DefaultOverlapRemovalAlgorithmParams).HorizontalGap = 50;
	((OverlapRemovalParameters)RhythmLogicCore.DefaultOverlapRemovalAlgorithmParams).VerticalGap = 50;

	RhythmGraphArea.LogicCore = RhythmLogicCore;
	RhythmGraphArea.VertexList.ForEach(vertex => {
		vertex.Value.Width = vertex.Key.size;
		vertex.Value.Height = vertex.Key.size;
		vertex.Value.Background = new SolidColorBrush(Color.FromRgb(
			byte.Parse(vertex.Key.r.ToString()),
			byte.Parse(vertex.Key.g.ToString()),
			byte.Parse(vertex.Key.b.ToString())
		));
		vertex.Value.SetPosition(vertex.Key.x, vertex.Key.y);
	});
}

The only reason I'm not including everything is because I'm not sure what parts are relevant.

Wrong dll in nuget

Today i tried to install last version of GraphX from nuget and faced problem.
GraphX 2.3.5.1 and GraphX 2.3.3 returns dlls with identical SHA-256 hash

LogicCoreChangedAction

Downloaded your master and tried building. The file LogicCoreChangedAction.cs in the project GraphX.WPF.Controls is missing

Had to create LogicCoreChangedAction.cs in the Enums folder with the following data

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GraphX.Controls.Enums
{
    public enum LogicCoreChangedAction
    {
        None           ,
        GenerateGraph  ,
        GenerateGraphWithEdges,
        RelayoutGraph,
        RelayoutGraphWithEdges,
    }
}

Use SimpleTreeLayout

Hello,
I try to use Tree Layout but i get a NullRefernceError. The other layouts like circular work.
Area.GenerateGraph(true, true);
This is were i get the Error.
Thanks :)

Edges arrows.

GraphArea.ShowAllEdgesArrows(false) doesn't work.
Custom edges that inherit from EdgeBase cannot be casted to EdgeControlBase at
private static void showarrows_changed(object sender, DependencyPropertyChangedEventArgs args) { var ctrl = sender as EdgeControlBase; ... }

LabelMouseDown removed

How can I have an event with the selected edge now ?
I used to use LabelMouseDown which had a EdgeLabelSelectedEventArgs with the current EdgeControl.
Now LabelMouseDown is removed and I can't have the same functionnality.
Can someone help me please and explain why this event was removed.

Cannot import keyfile error

I am trying to create a GraphX-based UWP project. I am using Win 10 with the latest stable version of VS/.NET.

When loading this example project, I got the following error:

Error Cannot import the following key file: uap_graphx.controls.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_84CEA4D79D6EBB21 GraphX.UAP.Controls

Additionally, when editing the XAML file, I get the following error on the ZoomControl block:

<controls1:ZoomControl x:Name="zc" ViewFinderVisibility="Collapsed" Grid.Row="1">
    <models:GraphAreaExample x:Name="graph" />
</controls1:ZoomControl>

Error The specified value cannot be assigned to the collection. The following type was expected: "UIElement". UAP.SimpleGraph C:\Users\borso\Downloads\GraphX-PCL2\GraphX-PCL\Examples\UAP.SimpleGraph\MainPage.xaml 19

Stack Overflow resources suggested to switch to Release mode, set the Platform of UAP.SimpleGraph to x86, and rebuild the project.

image

This resolved the issue once, but I cannot reproduce it again (i.e. now this fix does not work and I get the same error messages again). What should I try next?

NullRefernceException GenerateGraph

I'm getting an exception by calling:
gg_Area.GenerateGraph(True, true);

Exception:
GenerateGraph(LogicCore.Graph, generateAllEdges, dataContextToDataItem);

Do you know a Solution? Thanks

GraphX.WPF.Controls build target set to x86 instead of AnyCPU

How come GraphX.WPF.Controls build target (at Project Properties, Build tab) is set to x86 instead of AnyCPU? Example projects that add it as a reference are set as AnyCPU themselves and warn this may cause runtime issues (e.g. if you run them on x64 I don't know if they will talk to the x86 DLL via WoW64 [http://en.wikipedia.org/wiki/WoW64] which would make them run slower since they'd use marshalling probably or other context switching mechanism at each call into GraphX DLL)

Self-looped vertices

Currently the self-looped vertices are indicated with a star in the corner. I think this is somewhat unclear and unintuitive. An arrow which starts and ends in the same vertex would be better IMO. It also makes it possible to display label on these kind of edge.

[UWP] Cannot resolve Assembly System.Data.dll

I created a blank UWP app to try out the Tutorial. I referenced version 2.3.6 from NuGet, but then I get the following build error: Cannot resolve Assembly or Windows Metadata file 'System.Data.dll'

On a side note it would be nice to have pictures with the tutorial, or an example app in the store.

cheers

Grouping with EfficientSugiyamaLayoutAlgorithm as layout algorithm for groups

Good afternoon. Thx for your work around the library.
Grouping with RandomLayoutAlgorithm as LayoutAlgorithm for AlgorithmGroupParameters works fine for me, but grouping with EfficientSugiyamaLayoutAlgorithm just draws one last group and skips others. I use your standard GroupingLayoutAlgorithm<TVertex, TEdge, TGraph> as ExternalLayoutAlgorithm for core logic. Code with random group layout algorithm works with code from your project ShowcaseApp.Wpf in LayoutGrouped.xaml.cs. Is there any way to bring efficient sugiyama in my groups ?

MathHelper.cs issues

I see MathHelper.cs has some Russian comments in it, can you change those to English?

Also, I see very similar versions of it at GraphX.METRO.Controls and at GraphX.WPF.Controls that I can easily merge into one using some conditional compilation block near the top (the rest is very similar code as I see with WinMerge).

The question is where would the merged file be put? Should it go to GraphX.PCL.Common or to GraphX.PCL.Logic? I only see a Helpers/ThreadingHelper.cs at the 2nd one and an empty Helpers folder at the 1st one. Also I'd need to change the namespace to GraphX.PCL.Common.Helpers I guess instead of GraphX.WPF.Controls and GraphX.METRO.Controls that the two files have now

BTW, why use different namespaces in GraphX? You will never have WPF and METRO library linked together in the same project, so why not use the same namespace so that client code that uses the library can easily be ported (or shared via linked files) between WPF and METRO apps (and the coming UWA ones)? I've been using this practice in ClipFlair Studio and other projects and I'm very happy with code reuse (without even maintaining separate files, just have multiple projects for different platforms reference the same sources via linked files) like that.

...in my projects I even set the target assemblies to not have a platform in their name so that I can reuse XAML files (via linked files again) between WPF and Silverlight (else I'd need to have different XAML cause of XAML namespace definitions that needed assembly name). Metro unfortunately added the "using" syntax for XAML namespaces and MS uses that with UWA apps too and I think they don't support the older syntax at all which is very sad since they force you use separate XAML files in such case (given that there is no XAML include directive to include the rest of the common XAML between platforms). Can check the pattern I use with linked files at http://clipflair.codeplex.com/SourceControl/latest#Client/ZUI/ImageButtons/ for example (see the folders)

Latest Changes to Edges introduced a defect

The latest changes introduced a defect where a single standalone edge connector shape is being displayed once for each graph generation. I suspect the author of these changes will be able to quickly discover where this defect was introduced. If not, then please let me know so and I will research and fix.

This defect is reproducible in the WPF Show Case application.

image

Line endings and attributes

I've forked the GraphX repository, then cloned my fork from GitHub Desktop windows application, but I noticed that if I open repository settings there for that repo I see:

Line endings and attributes
The .gitattribures file controls line ending normalization and helps Git decide which files are binary and which are text. Learn more about .gitattributres (points here: https://help.github.com/articles/dealing-with-line-endings/) on github.com

  • Add the recommended .gitattributes file

[WarnIcon] This repository's line endings aren't normalized.
The best solution is to add the recommended file and make a one-time commit to fix line endings. If you don't want to use line ending normalization you can [turn this feature off]

a) the turn off action adds .gitattributes file with:

# Disable LF normalization for all files
* -text

b) the add action adds .gitattributes file (see link above for more info) with:

# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs     diff=csharp

# Standard to msysgit
*.doc    diff=astextplain
*.DOC    diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot  diff=astextplain
*.DOT  diff=astextplain
*.pdf  diff=astextplain
*.PDF    diff=astextplain
*.rtf    diff=astextplain
*.RTF    diff=astextplain

Feature - snap to grid, snap to neighbor

This is very useful when manually rearranging nodes. Snap to neighbor is a simple issue, maybe allow the function to have some options such as

  • Snap to vertical/horizontal centers
  • Snap to top/bottom/left/right border alignment

Snap to grid is somewhat trickier, as the grid can be relative to the screen (pixels), or relative to the control's zoom factor. Maybe both options should be considered.

Is it worthwhile pursuing? I think it'd be a nice feature for OCD-disabled people like myself.. 😆

Change Layout randomly

Hello,
if i use e.g. the FR algorithm and then use it again by clicking a button, it changes the layout. But the algorithm is the same. So why should it change with same algorithm and same data?
Thanks:)

Issue when using edges (WPF)

I get the following exception:
"Specified argument was out of the range of valid values. Parameter name: index"

> MS.Utility.FrugalStructList`1.get_Item(Int32 index)
> GraphX.Controls.EdgeControlBase.PrepareEdgePath(Boolean useCurrentCoords, Point[] externalRoutingPoints, Boolean updateLabel)
> GraphX.Controls.EdgeControlBase.UpdateEdgeRendering(Boolean updateLabel)
> GraphX.Controls.EdgeControlBase.UpdateEdge(Boolean updateLabel)
> System.Windows.FrameworkElement.ApplyTemplate()
> System.Windows.FrameworkElement.MeasureCore(Size availableSize)
> System.Windows.UIElement.Measure(Size availableSize)
> GraphX.GraphAreaBase.MeasureOverride(Size constraint)
> System.Windows.FrameworkElement.MeasureCore(Size availableSize)
> System.Windows.UIElement.Measure(Size availableSize)
> System.Windows.ContextLayoutManager.UpdateLayout()
> System.Windows.Interop.HwndSource.Process_WM_SIZE(UIElement rootUIElement, IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam)
> System.Windows.Interop.HwndSource.LayoutFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
> MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
> MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
> System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
> System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
> System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
> MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
> MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
> MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
> MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
> MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

When I generate the graph with edges. When I don't, it works. Since I render a binary tree of my Heap Sort algorithm it seems like it only happens with a certain set of vertices and edges. This is my generating code:

        private BinaryGraph BuildGraph(int[] data)
        {
            BinaryGraph graph = new BinaryGraph();

            foreach (int t in data)
                graph.AddVertex(new GraphVertex(t));

            GraphVertex[] vertices = graph.Vertices.ToArray();
            for (int i = 0; i < data.Length; i++)
            {
                int left = 2*i + 1;
                int right = 2*i + 2;

                if (left < vertices.Length)
                    graph.AddEdge(new GraphEdge(vertices[i], vertices[left]));
                if (right < vertices.Length)
                    graph.AddEdge(new GraphEdge(vertices[i], vertices[right]));
            }

            return graph;
        }

Everything else has been copied over from the sample application and works obviously.

A edge with same source and target vertices doesnt show up anything in the graph

List<Vertex> existingVertices = new List<Vertex>();
existingVertices.Add(new Vertex() { Text = "A", ID = 1});
existingVertices.Add(new Vertex() { Text = "B", ID = 2});

foreach (Vertex vertex in existingVertices)
   graph.AddVertex(vertex);

string edgeString = string.Format("{0}-{1} Connected", existingVertices[0].ID, existingVertices[0].ID);
graph.AddEdge(new Edge(existingVertices[0], existingVertices[0]) { Text = edgeString, ID = 1 });

The above code will not show up anything in the graph, Not even the vertices.
But if I change it like:
graph.AddEdge(new Edge(existingVertices[0], existingVertices[1]) { Text = edgeString, ID = 1 });
then it shows up.

If I have huge number of vertices and edges, and only one edge is gone wrong, its difficult debugging it. Atleast some error message should be shown OR such edges should be skipped.

Large Data Plotting Issue

If the data is large is takes quite time to load and it becomes quite slow when the graph is with images.
I want to load more than 5000 nodes. but it takes quite time to load more than 1000

Edges with same source and target overflow each other

Hello,
I'm very happy what I found such a library for creating graphs, but faced a problem when I create two edges with same source and target. I'm using your windows forms example code. I try to add edges like this:

var vlist = dataGraph.Vertices.ToList();
var obj1 = vlist[0];
var obj2 = vlist[1];
DataEdge dataEdge = new DataEdge(obj1, obj2) { Text = line1.Type, ID = line1.Id };
dataEdge = new DataEdge(obj1, obj2) { Text = line2.Type, ID = line2.Id };

Line1 and Line2 have different types and id, for example line1.Type = "Type1", line2.Type = "Type 2". When I build graph I see only "Type1" edge if I set allowParallelEdges=false, but if I set allowParallelEdges = true I see only "Type2". I think what two edges just overflow each other.
What should I do to create graph which will show me both edges?
Thank you in advance

Update Nuget for new release(2.3.7)

Hi! I use GraphX in my projects. New release version in the GitHub is 2.3.7, but latest available in the Nuget is 2.3.6. Can you please update Nuget for new version

Reresh the graph

Hey! First: Good work, keep it up, man. Second: I can't seem to find any method to refresh the graph after deleting a vertex or edge. Could you point me out how to do it, becasue after I call my methods to delete vertex/edge nothing happens. Relayout doesn't do the trick.

QuickGraph on NuGet has no PCL version?

When I clone GraphX repository locally (either from my own birbilis/GraphX fork or from the main panthernet/GraphX repo) and try to build I see that NuGet packages are missing and via Manage NuGet Packages (right clicking on various projects) I select to rebuild them (it fetches them from the network).

However when I compile I get error at "GraphX.PCL.Logic", that seems to be related to "QuickGraph" not having a PCL version on NuGet

Warning 2 Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled. Visit http://docs.nuget.org/docs/workflows/reinstalling-packages for more information. Packages affected: QuickGraph 0 0 GraphX.PCL.Logic

I also see the strange error

Error 1 The project 'Examples' is unsupported 0 0

with no more info

CancelRelayout does not stop background threads

GraphX.GraphArea.CancelRelayout() flags the BackgroundWorker.CancellationPending property, but none of the methods actually check the property and end the processing on that thread.

Since the layout algorithms can take quite a while to process, you will probably need to add in cancellation checks there as well.

Why field SourceConnectionPoint is internal?

Class EdgeControlBase has fields:
internal Point? SourceConnectionPoint;
internal Point? TargetConnectionPoint;

Why this fields is internal? I think they will be internal protected, because
I inherited class EdgeControl and override method PrepareEdgePath. In my class I can't set value to SourceConnectionPoint and TargetConnectionPoint. But method UpdatePosition of EdgeLabelControl uses value of SourceConnectionPoint and TargetConnectionPoint. But i don't want override UpdatePosition.

Repositionning vertices automatically after "OnPropertyChanged"

Hello,

First of all, I'd like to say your API is awesome. I can do a lot of great graph. I managed to implement Tasks that changes the property of my custom vertices and they appear on the graph with INotifyPropertyChanged.
But sometimes the modified value has a bigger height and width than before, so the vertex is bigger than before. Vertices can be one on another and it is not clean.

I would like to know if there is a method that reposition all the vertices (so I can use it at the end of my task)
Or if you have an idea.
Thank you.

RelayoutGraph() fails with ArgumentException "An item with the same key has already been added"

This only seem to happen when RelayoutGraph() is called when there are no edges. My solution is to place a guard around the call (EdgeList.Count > 0). I'm using GraphX in WPF, and the call stack looks like this:

at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at GraphX.PCL.Logic.Algorithms.LayoutAlgorithms.ISOMLayoutAlgorithm`3.Compute(CancellationToken cancellationToken)
at GraphX.PCL.Logic.Models.GXLogicCore`3.Compute(CancellationToken cancellationToken)
at GraphX.Controls.GraphArea`3._relayoutGraph(CancellationToken cancellationToken)
at GraphX.Controls.GraphArea`3._relayoutGraphMain(Boolean generateAllEdges, Boolean standalone)
at OurView.OnAutoLayoutRequested() in C:\Project\OurView.xaml.cs:line 370

It looks like the offending call is here:

VertexPositions.Add(VisitedGraph.Vertices.First(), new Point(0, 0));

Not sure why it's being added twice to the dictionary.

The code up to this point has been:

var nodeControl = new VertexControl(nodeViewModel);
GraphControl.Add(nodeViewModel, nodeControl);
nodeControl.Position = someValue;

Then it crashes on

GraphControl.RelayoutGraph();

My gut feeling is that some edge case is missed in the layout algorithm. It only throws when I have a single unconnected node in the layout!

Sorry for the vagueness!

ArgumentNullException for LayoutAlgorithmTypeEnum.Tree

Does anyone have an example of the Tree layout algorithm? Or is there some place that defines what each layout algorithm requires?

 "Value cannot be null.\r\nParameter name: dictionary"
    at System.Collections.Generic.Dictionary`2..ctor(IDictionary`2 dictionary, IEqualityComparer`1 comparer)
    at System.Collections.Generic.Dictionary`2..ctor(IDictionary`2 dictionary)
    at GraphX.PCL.Logic.Algorithms.LayoutAlgorithms.SimpleTreeLayoutAlgorithm`3.Compute(CancellationToken cancellationToken)
    at GraphX.PCL.Logic.Models.GXLogicCore`3.Compute(CancellationToken cancellationToken)
    at GraphX.Controls.GraphArea`3._relayoutGraph(CancellationToken cancellationToken)
    at GraphX.Controls.GraphArea`3._relayoutGraphMain(Boolean generateAllEdges, Boolean standalone)
    at GraphX.Controls.GraphArea`3.GenerateGraph(TGraph graph, Boolean generateAllEdges, Boolean dataContextToDataItem)
    at Project.Views.Trace.ImpactVisualizer..ctor(ImpactVisualizerViewModel vm) in C:\LocalCode\Project\ALHP_Inventory\Views\Traceability\ImpactVisualizer.xaml.cs:line 70
    at Project.ViewModels.MainWindowViewModel.<>c.<get_ShowTraceabilityImpactCommand>b__105_0() in C:\LocalCode\Project\Project\Project\ViewModels\MainWindowViewModel.cs:line 382
    at Project.Commands.DelegateCommand.Execute(Object parameter) in C:\LocalCode\Project\Project\Commands\DelegateCommand.cs:line 42
    at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
    at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Here is the code... it's pretty barebones.
I've tested a few other layout algorithms and they work just fine.

core.DefaultLayoutAlgorithm = LayoutAlgorithmTypeEnum.Tree;
core.DefaultLayoutAlgorithmParams = core.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.Tree);
core.DefaultOverlapRemovalAlgorithm = OverlapRemovalAlgorithmTypeEnum.FSA;
core.DefaultOverlapRemovalAlgorithmParams = core.AlgorithmFactory.CreateOverlapRemovalParameters(OverlapRemovalAlgorithmTypeEnum.FSA);
core.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.SimpleER;
core.DefaultEdgeRoutingAlgorithmParams = core.AlgorithmFactory.CreateEdgeRoutingParameters(EdgeRoutingAlgorithmTypeEnum.SimpleER);
core.AsyncAlgorithmCompute = false; 
graphArea.LogicCore = core; 
graphArea.GenerateGraph(graph);

It has something to do with vertex sizes I believe, but I can't figure out what I am missing, there are no examples of this layout type.

How to get deterministic results?

Would be good if we could get deterministic results when it generates the layout. Is there a way to do this?

The algorithms are clearly using Random() somewhere within them. Is there a way to set the seed so we can get predictable results?

Crash when using Tree Layout

The WPF Showcase crash when selecting the Tree layout.
it crash in the first line of SimpleTreeLayoutAlgorithm.Compute(..) method because VertexSizes is null.

public override void Compute(CancellationToken cancellationToken)
        {
            //crash here
            Sizes = new Dictionary<TVertex, Size>( VertexSizes );

I made it work by adding VertexSizes = new Dictionary<TVertex, Size>(vertexSizes); in the constructor

public SimpleTreeLayoutAlgorithm( TGraph visitedGraph, IDictionary<TVertex, Point> vertexPositions, IDictionary<TVertex, Size> vertexSizes, SimpleTreeLayoutParameters parameters )
            : base( visitedGraph, vertexPositions, parameters )
        {
            VertexSizes = new Dictionary<TVertex, Size>(vertexSizes);
            //Contract.Requires( vertexSizes != null );
            //Contract.Requires( visitedGraph.Vertices.All( v => vertexSizes.ContainsKey( v ) ) );

        }

Animation Trembling at METRO app

at METRO app, there is lots of animation trembling when one changes algorithm (also the 2nd option does the same, 3d one doesn't) and presses the refresh button

Move to C#6 features

I looked at source code and saw a lot of places to use latest C# 6 features. So what you say if i will make changes and submit PR?

WPF Showcase app missing some UI panel?

at WPF showcase app, one of the screens has a help button at its top-right (inside the graph area). If you press it you see a dialog, where apart from a typo in the text (says "this behaviors" instead of "this behavior" if I understand what the text wants to say), there is also a mention on some settings panel, that is however missing from that screen

Edge label doesn't show up

The edge label in WindowsFormsProject doesn't show up?
Here what it says in console:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='GraphX.Controls.EdgeLabelControl', AncestorLevel='1''. BindingExpression:Path=Angle; DataItem=null; target element is 'RotateTransform' (HashCode=52646021); target property is 'Angle' (type 'Double')

[2.3.5] External layout algorithms: All VertexSizes passed in are (0,0)

To reproduce:

  1. Create a custom layout algorithm by inheriting from IExternalLayout<TVertex, TEdge>
  2. Make sure NeedVertexSizes returns true (otherwise VertexSizes will be null)
  3. Put a breakpoint on Compute(...) and inspect the elements in VertexSizes (all are zero-sized)

Bug cause (assumption):

public Dictionary<TVertex, Size> GetVertexSizes()
{
    //measure if needed and get all vertex sizes            
    Measure(new USize(double.PositiveInfinity, double.PositiveInfinity));
    var vertexSizes = new Dictionary<TVertex, Size>(_vertexlist.Count(a => ((IGraphXVertex)a.Value.Vertex).SkipProcessing != ProcessingOptionEnum.Exclude));
    //go through the vertex presenters and get the actual layoutpositions
    foreach (var vc in VertexList.Where(vc => ((IGraphXVertex)vc.Value.Vertex).SkipProcessing != ProcessingOptionEnum.Exclude))
    {
        vertexSizes[vc.Key] = new Size(vc.Value.ActualWidth, vc.Value.ActualHeight);
    }
    return vertexSizes;
}

Note: ActualWidth and ActualHeight (If I am right) are determined in the Arrange/Render step
and vc.Value.DesiredSize.Width and vc.Value.DesiredSize.Height should be used instead.

Workaround:

public class MyExternalAlgorithm: IExternalLayout<DataVertex, DataEdge>, ILayoutEdgeRouting<DataEdge>
{
    private MyGraph Graph { get; set; }

    private void WorkaroundForZeroVertexSizes()
    {
        var vertexControls = GraphArea.GetAllVertexControls();
        foreach (var vertexControl in vertexControls)
        {
            var vertex = vertexControl.Vertex as DataVertex;
            VertexSizes[vertex] = new GraphX.Measure.Size()
            {
                Width = vertexControl.DesiredSize.Width,
                Height = vertexControl.DesiredSize.Height
            };
        }
    }

    public void Compute(CancellationToken cancellationToken)
    {
        WorkaroundForZeroVertexSizes();
        // Now VertexSizes should be properly assigned
    }

    public IDictionary<DataVertex, GraphX.Measure.Point> VertexPositions { get; set; }
    public IDictionary<DataVertex, GraphX.Measure.Size> VertexSizes { get; set; }

    public bool NeedVertexSizes
    {
        get { return true; }
    }
    public bool SupportsObjectFreeze
    {
        get { return false; }
    }

    public MyExternalAlgorithm(MyGraph graph)
    {
        Graph = graph;
    }
}

VB.net WinForms example

I tried to do a rebuild all at the latest GraphX that GitHub Desktop brought to my machine

at the C# WindowsFormsProject I had to right click and Manage NuGet Packages, then had to select to restore missing NuGet Packages. Not sure if this is by design to avoid checking in QuickGraph's code

(1) at the WindowsDesktop_VB.NET_WinForms_Example (that one btw could have a better project name, could strip the WindowsDesktop_ prefix and maybe rename to Example.WinForms.VB) I had to manually add an extra NuGet Package for "YAXLib" to build

(2) now I have a warning at Models\DataEdge.vb in that project at "ToString" where it says you're shadowing the ToString method of the ancestor instead of overriding it. That is an "Overrides" qualifier is missing there. That will cause issue if the ToString method is called from code that accepts an Object or any other ancestor of DataEdge, since it will call the original ToString, not this method. I also see "0 references" in hint above the function, so I guess "Overrides" is indeed missing there, since it isn't called explicitly

Feature - Graphs of graphs (or grouped graphs)

Have you seen yFiles by yWorks? They have a killer feature, and that is what they call "grouped graphs". See at the bottom of this page for a description plus screen shot: https://www.yworks.com/en/products_yfilesdotnet_about.html

I have been toying with the idea to implement this in GraphX. I think it's a pretty cool feature. It allows for some pretty cool organization of data!

Now, I think I know how to pull it off from a pure data structure perspective: that part is easy (or I'd like to believe so). What is less easy however, is: How should nodes be laid out? For an example of what is possible with their toolkit, yWorks has a free diagram editor called yEd (https://www.yworks.com/en/downloads.html#yEd). It is implemented with their Java offering, but from what I can tell, the Java and the .NET counter part are on par feature wise. yEd allows you to build diagrams, and perform layouts. When they perform layouts, they lay all nodes out, grouped or not, and then they resize the group boundary to a minimal rectangle around the grouped nodes. This behaviour might well be configurable, should one use their class libraries.

I would like to let the user decide how grouped nodes should be laid out. A layout could mean:

  1. Layout as yEd allows you to do (see description above)
  2. Option to only lay out the top level nodes/groups, and maintains each group's internal layout
  3. Option to only layout the internal nodes of a node group
  4. Option to recursively apply a combination of 2 and 3

What do you think? Do you foresee any obvious obstacles?

As I see it, this is a cross cutting feature. It would require:

  • alterations to the graph data structures
  • alterations to the algorithms
  • alterations to the controls (both WPF and store apps)

It's a tall order, and I will probably need help doing this, as I'm not fully familiar with the internals of GraphX, and I am by no means a graph layout algorithm expert. What do you think?

Change vertex position

Hi! As far as I understand, to set the position of the new vertex I should use VertexControl::SetPosition() and then add it using GraphArea::AddVertex. Is there any method to change the position of already added vertex?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.