Static version of public source Graphviz libraries
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I need a working setup in order to include the Graphviz libraries in my program for later distribution through Apple Mac AppStore with its sandboxing restriction. This requires as well that I don't need a configuration file "config6" as this is not aligned with sandbox restrictions.
My key interest is in node and edge positioning as I expect my nodes to look very different from standard Graphviz nodes.
This can be done in at least two ways.

I) Static Library

Scripts etc. in order to create static libraries from the Graphviz libraries that I can link with macOS and iOS applications in Xcode. Graphviz can easily be installed using Homebrew on a Mac and does compile. However, the result are dynamic libraries. In order to deliver through the Apple App Stores (macOS & iOS) I would like to use static libraries. Another problem that I try to avoid is the configuration file (“config6”) for graphviz that doesn’t work well with the Sandbox.

All of this was already done once by Glen Low. He gave instructions that path the way (see first link below). I believe this to be relatively easy task for somebody that is used to GNU autotools (./configure, make, make install). Unfortunately, I lack knowledge of GNU Autotools to take it further.

II) Graphviz ports, e.g. vis.js.

Any other way to include the Graphviz libraries into my program that doesn't include a static library, including the javascript version of Graphviz.

Solution must have:

1. Clear repeatable steps to create all dependables (static libraries, etc.) from open source repositories.

2. Solution must not use the graphviz configuration file config6 at all. Instead a static initiation is needed. I assume that such an initiation involves to set lt_symlist_t lt_preloaded_symbols[]. See the builtins.c file from Glen Low (see below).

3. Solution must be compilable & executable for macOS Sierra without any dynamic graphviz libraries. I need to be able to reproduce the steps. Any additional comfort is much welcome.

4. Solution is not allowed to depend on any none-standard dynamic libraries. I want it to be able to run on any Mac. And I want to be able to distribute through App Store.
5. A small demo program showing that communication to library works. I have a minimal working Swift wrapper below but another wrapper might be enough.

Solution should have:

1. Should work together with GraphvizWrapper.

2. Should work together with useGV
3. Should come with a small sample Xcode project that puts it all together.

4. An iOS version should be covered. I believe that it would only entail small changes.

Nice to have:

1. Selection of included Graphviz libraries. How can one add one or more libraries?

2. Result checked in as Homebrew formula or as a GitHub open source project (e.g. https://github.com/TheMadOne/GraphvizWrapper/, please note that that GitHub project is a failed attempt where I tried to package dynamic libraries). I think the great Graphviz library should be available for everybody that wants to use the App Store.

3. Result is configured as a Framework for macOS and iOS. This might make it easier.

4. Result can take a graphical description of the node (NSView, or any derived format, like NSImage, or an .png) and incorporates it into the graph created by Graphviz.

Relevant links:

1. Overall, but outdated, guidelines from Glen Low: http://marc.info/?l=graphviz-devel&m=132335419922240 I believe this is rather complete. A few comments:

* The builtins.c file is meant to replace the need for config6 file by providing a static initiation of plugins

* cgraph seems to be standard by now
* A few other libraries might be outdated. I am mostly interested in basic plugins.

* I am not understanding why he wants directories created and what they are used for.

2. http://www.graphviz.org/content/graphviz-iphone - another interesting comment from Glen Low.

3. http://www.graphviz.org/pdf/libguide.pdf - Graphviz as a library, however this is based on dynamic libraries
4. Just found this one: there might be an even easier way to do this: http://graphviz.996277.n3.nabble.com/Bundling-graphviz-libraries-td330.html#a337

awarded to Chlegou

Crowdsource coding tasks.

1 Solution

Winning solution

Hi,

i see that your goal is to build a graphviz graphs in your apps, once, i worked with the graphviz library to display graphs in browser.

Website: http://www.graphviz.org/

instead for building the graphs in server, and generating it , i found that it's better to make it with a Js script, using the js library. so like that, no need to server buildings and stuff.

i used it, and was really perfect for me, since i can do what i want though JavaScript!

Also, i used a graphviz highling plugin, that when selecting a node, will highlight all related nodes to it.

i suggest using the Js library instead, can be used on any kind of devices! like that, you don't have to worry about the display devices, since the Js script, generate a svg graph, and with the highlight will be a perfect solution.

if you want to switch to Js graphviz library, we can do it.

2.The Graph can be interpreted like that:

digraph G {

    subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        a0 -> a1 -> a2 -> a3;
        label = "process #1";
    }

    subgraph cluster_1 {
        node [style=filled];
        b0 -> b1 -> b2 -> b3;
        label = "process #2";
        color=blue
    }
    start -> a0;
    start -> b0;
    a1 -> b3;
    b2 -> a3;
    a3 -> a0;
    a3 -> end;
    b3 -> end;

    start [shape=Mdiamond];
    end [shape=Msquare];
}

code is simple, and easy to use!!

Graphviz JS + Graphviz Jquery highlight plugin ==> is my Solution!!

Link to official highlight demo: https://cdn.rawgit.com/mountainstorm/jquery.graphviz.svg/master/demo.html

Hope you like my suggestion.

Edit

  1. in my approach, a webpage must implement the script:

    <script src="path/to/viz.js"></script> //this script is the Js library of graphviz

  2. you add the graph content like in the example i described before.

  3. then the webpage will get the graph on it. (as s SVG content)

  4. you display that webpage in your app (embed it), and boom it's done!

if the graph is static, then you generate the graph and save it in a webpage, then display it. if it's dynamic, then you need a php webpage is your server (that will generate the graph), then the embedded webpage will do it. (or, you can do it through json if you want... what really fit your case!)

I am not sure I fully understand. I would like to distribute an app through the App Store that uses Graphviz. If I would use your approach, how could I use Graphviz? Do you have a Graphviz server that I can query?
TheMadOne 6 months ago
i updated my solution, check it, hope it clarify it. we can even make a voice call through gmail if you want. my email is nicolastsue@gmail.com
Chlegou 6 months ago
Got it. Not necessarily what I was looking for - yet. But I will look into this. And if this is what I need I might accept this. Feel free to provide a bit more of the requested, like a demo project, etc. But already now a "thank you". One more thing. I am not really interested in the graphics. I am more interested in the positioning of my nodes. However, this highlight plugin looks interesting and might change a few things. Where can I learn more?
TheMadOne 6 months ago
well that's why didn't specify my solution, since i know how it goes. you have my email (in last comment), you can email me anytime, and we can make a call, maybe we can figure out the best approach for you. it's up to you. and for the highlight script, this is the library link: https://github.com/mountainstorm/jquery.graphviz.svg/ when you confirm using it, i will help you working with it. i already worked with it before
Chlegou 6 months ago
for the nodes display positions, i believe will fit you project. in my experience with graphs, i can confirm that graphviz is the best choice for free libraries. and will be awesome by the end. ...we will see that by the end when you confirm using it
Chlegou 6 months ago
Would it be sufficient to package graphviz as a standalone OSX application? I don't know how to do this, but someone must. I have wanted to generate this from homebrew or macports build products, but not really sure how. Stephen North
magneticnorth 6 months ago
Hi Magnetic North. I am not sure I understand your idea. Yes, I intend to create a standalone OSX app, one that includes Graphviz as a static library. Graphviz is intended to be part delivered as a dynamic library. And that doesn't fly for some reason with the Sandboxing. Graphviz comes as separate applications, but they require dynamic libraries. But feel free to provide more input.
TheMadOne 6 months ago
Houcem, I thought about your idea, and it might actually work. Remaining concern would be regarding speed and potentially power consumption. But I assume that it will be fast enough. I don't expect graphs with several hundreds of nodes. But is there any concern on your side? However, I think JS could qualify. I would most likely use graphviz as a black box, hence I don't care whether the code is compiled or interpreted, etc. Did you see my graphvizWrapper file? I would most likely want to encapsulate Graphviz similar. A simple interface taking a dot-file and returning the outcome in a way that I can query node positions and edge points would be sufficient. What would such an interface take?
TheMadOne 6 months ago
as i said before, graphviz Js, is easy and perfect library to work with. and even easy, not complicated to use. if you want to move nodes positions (let me know from now), there are several scripts, more specified for these things, so better i know what you exactly want. i checked your files, but in principle, i have seen integrating graphviz in servers not in mobile apps, and even if there is a way to what to basically think about, still believe that JavaScript is better choice.
Chlegou 6 months ago
I am not sure that I can do the right node looks for what I have in mind. Hence, I might would like to be flexible. But maybe there are possibilities here as well? Assuming I could create an image of the node, could I include it into the graph? How efficient would that be?
TheMadOne 6 months ago
yes we can add images. better if you fix your choices and what you want, then pass it to me, and i will give you the right choice.
Chlegou 6 months ago
Houcem, I updated the request, your approach will not qualify. Images are a nice to have. For now, I still mostly care about the positioning of nodes to be presented separately. Thanks!
TheMadOne 6 months ago
nodes can be presented SEPARATED vertically or horizontally! and it's easy with graphviz! trust me i'm kind of expert at graphviz, was studying it for 10 days! i know a lot of it, and i can place node the way you like! what you have to do, is to CONFIRM using the Js library (web content) and the rest, i can take care of, i will give you an example, that will shows what you want, and you will see that by the end. and trust me, i can do what you want! a lot of opportunities with graphviz!
Chlegou 6 months ago