Tell the library / classes to visualize graphs.
IDE QT5 or VS 2017 . C ++ or C # language .
Task: implement the tasks on the theory of automata for the desktop.
Have the ability to create / delete vertices, edges. Move vertices.
- Visualization in a desktop application for C # - WPF - tym32167
- Yes, the program for the desktop - Kto To
2 answers
The question does not indicate how complex graphs can be
Experience
Did a similar coursework on delphi - set the graph, draw and select the shortest path on it. I did everything myself - The draw method accepted the incidence matrix and drew a graph. On the form, you can make controls for editing this matrix, in my case a file with the specified formatting was used.
More recently drew a triangle - a small chip was in scalability, because the triangle should have been placed in a given area. Used this approach:
- maxLengh = getMaxSide (triangleSides) is the longest side of the triangle.
- baseLength = 200 is the maximum length of the side that I can draw
- scale = maxLength / baseLength coefficient, then how many times you need to increase each side to keep the proportions of the triangle
- drawSides = map (triangleSides, side => side * scale) multiply each side of the triangle by scale, resulting in triangle sides that are guaranteed to fit in the area.
Overview
There is no ready-made graph editor api, but there are several options for visualizing graphs - i.e. just draw, there is a library for working with graphs. You may have to abandon the idea of dragging nodes. I would use graphx + quickgraph - links below. The simplest option is to make drawing and editing the graph separately through editing the incident matrix.
Alternatives
- Python - I have not tried it myself, but I heard it is good at drawing graphs
- d3js + fabricjs - do everything on canvas in the browser, it's relatively easy to get a really cool editor. d3js is a library for creating data mapping for graphics, drawing simple graphics with it. fabricjs - editing on canvas, using it to edit images on the site. If you use them together, you can write your own graph editor with drag and drop and any features you want to add, for example, select several nodes and drag, or delete edges by click. Using an electron, you can even make a desktop application.
Visualization Libraries
- https://archive.codeplex.com/?p=graphx my choice
- https://github.com/komorra/NodeEditorWinforms can be useful
- https://archive.codeplex.com/?p=graphsharp
- https://github.com/JamieDixon/GraphViz-C-Sharp-Wrapper generates a picture that can be displayed in the control, the easiest
Library for working with graphs
https://archive.codeplex.com/?p=quickgraph
Ready project that is similar to the requirements
https://www.codeproject.com/Articles/562829/Building-an-oriented-graph-in-a-graphical-applicat
If anyone is interested, QT has written a program for drawing graphs. Source code at github.com/fryn3/elasticnodes . And this is in the development of github.com/fryn3/widGraph .