gephi 0.8.2 failed to recognise the number of nodes and edges - dot

I used java to generate some dot files, but Gephi 0.82 can only open some of them correctly. For some files, it showed 0 for the number of edges and nodes and no other error information. In fact, Gvedit can open them correctly. The following is a failed file:
digraph G {
ranksep=.25;
edge [arrowsize=.5]
node [shape=box, fontsize=10, fixedsize=false, height=.45];
"acc_spec/5"; "edcg_error/2"; "loading_file_position/1"; "acc_name/5"; "is_acc_name/1"; "loading_module/1"; "acc_default_init_value/2"; "make_accs_frame/4"; "acc_direction/2";
"acc_spec/5" -> "edcg_error/2";
"edcg_error/2" -> "loading_file_position/1";
"acc_spec/5" -> "acc_name/5";
"acc_name/5" -> "edcg_error/2";
"acc_name/5" -> "is_acc_name/1";
"is_acc_name/1" -> "loading_module/1";
"acc_name/5" -> "acc_default_init_value/2";
"acc_default_init_value/2" -> "loading_module/1";
"acc_name/5" -> "make_accs_frame/4";
"make_accs_frame/4" -> "acc_direction/2";
"acc_direction/2" -> "loading_module/1";
}

There are some bugs with Gephi 0.82. After I checked out the latest source code from its github repository, compiled it and ran, the number of nodes and of edges are both correct.
the checked-out version is 0.9-snapshot master with netbeans 7.4.

Related

Generating a plantuml sequence diagram from a textfile description using iplantuml library

Hi does anybody knows how to read a text file and put it inside the #startuml and #enduml, the goal of this would be to make the printing of the sequence diagram more automatical inside a jupyter notebook
#startuml
read(~/Doc/trace.txt)
#enduml
thanks in advance for any help
For me having the files:
main.pu
\#startuml
!include file1.puml
\#enduml
with file1.puml (with and without #startuml / #enduml doesn't make a difference:
C -> C : stuff3
D -> D : stuff4
and running:
java -Djava.awt.headless=true -jar plantuml.jar main.pu
Results in:
I used version:
PlantUML version 1.2020.17beta5

Files as input and output in plantuml

I am trying to write the following flow:
The activity I describe consists in two binaries. The first one takes in input one file, and generates several (let's say two). These two files, plus another one from the environment, are fed to a second binary, which will generate an output file.
I would like to use plantuml to describe this, but the documentation doesn't really help - it doesn't go to the inputs/outputs of activities.
I can draw files with file myFile, but I didn't manage to link them to boxes. Should I rather use a usecase diagram or an activity diagram for this? Can someone show me how to draw an arrow from a file to a (binary) ?
I am now standing with
#startuml
file myFile
(firstBinary)
#enduml
which doesn't really do what I want.
Should I rather use a use case diagram or an activity diagram for this?
The closest diagram associated with what you are trying to depict would be a process flow diagram with work product/artifact dependencies. In essence, your binaries are processes that depend on artifacts (files) and create new ones. However, not everything we want to describe fits neatly into a particular diagram type, nor should it have to.
Since PlantUML uses GraphViz to render diagrams, you can always use the DOT language to specify these relationships directly. For example,
#startuml
digraph a {
InFile1 [shape=note]
Binary1 [shape=ellipse]
TmpFile1 [shape=note]
TmpFile2 [shape=note]
TmpFile3 [shape=note]
Binary2 [shape=ellipse]
EnvFile [shape=note]
OutFile [shape=note]
InFile1 -> Binary1
Binary1 -> TmpFile1
Binary1 -> TmpFile2
Binary1 -> TmpFile3
TmpFile1 -> Binary2
TmpFile2 -> Binary2
TmpFile3 -> Binary2
EnvFile -> Binary2
Binary2 -> OutFile
}
#enduml
would result in the following diagram.
DOT is no more complex than PlantUML's language, though when diagrams get large, a good understanding is certainly a benefit. You can get more information on DOT language at Graphviz's Documentation site.

Building and processing a compile graph on a set of watched source files

I think this might be a quite common problem, but somehow it is hard to find suitable answers.
Background
I'm currently investigating how to speed up the node variant of Patternlab. It is basically a system where you create HTML template files containing some fundamental elements (called atoms) like headings, paragraphs, etc. and compose them into something bigger (molecules), then compose multiple molecules until you have a full web page.
The template files are processed by a template engine which is able to reference and include other template files.
Patternlab now would read all files and build a graph of each file's predecessors and ancestors.
The problem is, all files in the template directory(s) are read, processed, the compile output from the template engine is written somewhere, done. This takes about 1 Minute for 10-20 MB of HTML Templates (think e.g. of Mustache). It would be much nicer to have differential updates.
General problem
Given a directed acyclic graph of files(nodes) f and f1 → f2 for f1 includes f2 in its contents. When in f1 → f2 needs also to be recompiled(i.e. the compilation order should be f2, f1) , how to find the set of all files that need recompilation efficiently and what are the initial and target nodes, when there might be a path containing multiple changed files and nodes depending on multiple paths?
Given two parallel paths (i.e. f1 → f2 → f5 and f1 → f4 → f5) how to find the best set of paths for parallel compilation (i.e. by total length of the path) with a minimum length l?
Considerations
So how could this be done? We simply have to watch the template directories for the events create, modify and delete. This could be done by collecting file system events from the kernel.
Remember that for any file we can also receive the "last modified" timestamp (mtime).
The first step, building an initial graph is already done by patternlab. Each node of the graph consists of:
the source file path and mtime
the target file path and mtime
a set of parameters for the file (i.e. username, page title, etc.)
a changed flag that indicates if the file was modified by inspecting the mtimes(see below). This always reflects the current file system state (much simpler).
i.e. there is a "shadow" graph compiling the most current compile output.
This leads to these cases:
source.mtime <= target.mtime: The source was compiled and not modified afterwards. If the source file is changed after building the graph,
source.mtime > target.mtime: The source was changed before building the graph and must be recompiled
Now the idea is to recompile each node if the changed flag is set and return the contents of the target file otherwise.
When a file is compiled, all files referencing this file (e.g. all nodes with incoming edges to the node) must be recompiled as well.
Consider that when the source hsa been compiled to the target, the flag changes to false so it does not get compiled twice. Returning the target content when visited again is okay though.
There are multiple root nodes (only outgoing edges, i.e. pages),some that are "leafs" (only incoming edges, i.e. molecules) and also nodes with no
Assume that patternlab cannot run in paralell, i.e. there is a "busy" flag blocking concurrent overall runs.
However it might be beneficial to use all CPU cores for compiling templates faster and employ content caching for templates that were not modified.
If a file f1 includes two other files f2, f3 and f2, f3 both have files that need recompilations as successors, f1 must wait for all paths to be recompiled first.
For instance (c = changed)
f5 -> f6 (c)
^
/
f1 -> f2 -> f3 -> f4(c)

'No converter registered for type Deedle.Frame' using F# R type provider and ggplot2

I'm working on my first attempt to use R's GGPlot2 via the F# R type provider.
Here's my code:
let (++) (plot1:RDotNet.SymbolicExpression) (plot2:RDotNet.SymbolicExpression) =
R.``+``(plot1, plot2)
let ChartGgPlot2 (prices : Prices) =
try
let fileName = makeFile ".png"
let priceSeries = prices.Prices |> Seq.map (fun p -> p.Date, p.Close) |> series
let dataFrame = Deedle.Frame.ofRecords priceSeries
R.png(filename=fileName, height=200, width=300, bg="white") |> ignore
R.ggplot(
namedParams[
"data", box dataFrame;
"mapping", box (
R.aes__string(x="Date", y="Close"))])
++ R.geom__point() |> ignore
R.dev_off() |> ignore
fileName |> Choice.succeed
with
| e -> Choice.fail e.Message
p.Date is a System.DateTime and p.Close is a double.
At runtime I get this exception at the point of calling R.ggplot:
No converter registered for type Deedle.Frame`2[[System.DateTime,
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089],[System.String, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] or
any of its base types
I've tried the solution suggested suggested here (copying two DLLs): Deedle frame to R but that didn't make a difference.
I should also say that my usage of series and Frame.ofRecords is pretty much guesswork at this point.
Many thanks.
Edit:
It's a compiled .NET 4.6 project with RProvider (1.1.20) and Deedle.RPlugin (1.2.5) added via Nuget.
ggplot2 works correctly from RGui.
Tomas's comment about config files and probing locations wasn't the answer - but it clued me in to what actually was the answer.
I needed to use Nuget to add references to Deedle.RPlugin, not only to the assembly that was doing the R calls to render a chart, but also to my 'main' assembly that references the charting assembly.
I don't know if this is an inherent limitation in the way the build system interacts with the type provider. But for now I'm very happy to have a workaround.
(For teaching purposes it would be great to know if there could be a long term fix.)
Huge thanks to those that replied.
It's quite possible something is off with your FSLab and/or Rprovider install. This for example should work:
#load #"..\..\FSLAB\packages\FsLab\FsLab.fsx"
open System
open Deedle
open FSharp.Charting
open System
open RDotNet
open RProvider
open RProvider.graphics
open RProvider.stats
open RProvider.datasets
open RProvider.ggplot2
type DtPx = {
Dt:System.DateTime
Px:float
}
let rnd = System.Random()
let nextPx() = rnd.NextDouble() - 0.5
let nextDay i = DateTime.Today.AddDays(float i)
let data = List.init 100 (fun i -> {Dt=nextDay i;Px = nextPx()})
let df = Frame.ofRecords data
let mtc = R.mtcars.GetValue<Frame<string, string>>()
let (++) (plot1:RDotNet.SymbolicExpression) (plot2:RDotNet.SymbolicExpression) =
R.``+``(plot1, plot2)
R.ggplot(
namedParams[
"data", box mtc;
"mapping", box (
R.aes__string(x="disp", y="drat"))])
++ R.geom__point()
R.ggplot(
namedParams[
"data", box df;
"mapping", box (
R.aes__string(x="Dt", y="Px"))])
++ R.geom__point()
You can use this in an fsx file, but also in a compiled .exe to save the output to png. In that case you will have to reference DynamicInterop, RDotNet, Rprovider, etc as well.
References:
This is for an empty project nugetting Deedle and RProvider related packages.

loading RProvider in F#

I'm still a noob with F#, and I don't understand all the syntax and logic for loading and using packages.
For example, i would like to use (Blue Mountain's) RProvider.
http://bluemountaincapital.github.io/FSharpRProvider/index.html
Using VS2015, in my current solution, I've installed the package with the PM console and Install-Package RProvider
I modified a bit the RProvider.fsx because I've got newer versions of R.NET Community
#nowarn "211"
// Standard NuGet or Paket location
#I "."
#I "lib/net40"
// Standard NuGet locations for R.NET
#I "../R.NET.Community.1.6.4/lib/net40"
#I "../R.NET.Community.FSharp.0.1.9/lib/net40"
// Standard Paket locations for R.NET
#I "../R.NET.Community/lib/net40"
#I "../R.NET.Community.FSharp.1.6.4/lib/net40"
// Try various folders that people might like
#I "bin"
#I "../bin"
#I "../../bin"
#I "lib"
#I "../packages"
// Reference RProvider and RDotNet
#r "RDotNet.dll"
#r "RDotNet.FSharp.dll"
#r "RProvider.dll"
#r "RProvider.Runtime.dll"
open RProvider
do fsi.AddPrinter(fun (synexpr:RDotNet.SymbolicExpression) -> synexpr.Print())
Now my questions are
1) how to load a package (RProvider) from F# interactive ?
well actually i managed to do it this way
For example the RProvider.fsx file is in the path
C:\Users\Fagui\Documents\GitHub\Learning Fsharp\Algo Stanford\packages\RProvider.1.1.15\RProvider.fsx
what i did is
#I #"C:\Users\Fagui\Documents\GitHub\Learning Fsharp\Algo Stanford";;
#load "packages\RProvider.1.1.15\RProvider.fsx";;
and it works :-)
but can I avoid writing the whole path ?
2) In VS2015 if I want to include it in a solution...
in the solution explorer i have included the RProvider.fsx file (below AssemblyInfo.fs, App.config and packages.config come after, is this right ?)
and last the program itself Rtype.fs
I'm trying to reproduce the example from
http://bluemountaincapital.github.io/FSharpRProvider/Statistics-QuickStart.html
open System
open *RDotNet* // the namespace or module 'RDotNet' is not defined
open *RProvider*
open *RProvider*.graphics
open RProvider.stats
// let x = System.Environment.CurrentDirectory
// val x : string
printfn "hello world"
Console.ReadKey() |> ignore
// Random number generator
let rng = Random()
let rand () = rng.NextDouble()
// Generate fake X1 and X2
let X1s = [ for i in 0 .. 9 -> 10. * rand () ]
let X2s = [ for i in 0 .. 9 -> 5. * rand () ]
// Build Ys, following the "true" model
let Ys = [ for i in 0 .. 9 -> 5. + 3. * X1s.[i] - 2. * X2s.[i] + rand () ]
let dataset =
namedParams [
"Y", box Ys;
"X1", box X1s;
"X2", box X2s; ]
|> R.data_frame
let result = R.lm(formula = "Y~X1+X2", data = dataset)
let coefficients = result.AsList().["coefficients"].AsNumeric()
let residuals = result.AsList().["residuals"].AsNumeric()
let summary = R.summary(result)
*summary.AsList().["r.squared"].AsNumeric()
R.plot result*
//this expression should have type 'unit' but has type 'NumericVector'...
I'm getting some warnings/errors by Intellisense although the compiler managed a build.
When executing the exe, it looks like the windows screen is busy, i manage to see some graphs, but they look like they have got nothing to do with what Rtype.fs is saying...
thanks for helping !
EDIT
First of all, I would not recommend using a different version of R.NET than the one that RProvider installs automatically as a dependency. The loading is a bit fragile and it might break things.
1) Regarding the path, you should be able to pass relative path to #load, so just dropping the #I from your script should do the trick.
2) When referencing a dependency from a project (rather than from a script file), you need to add a dependency to the project references. In Visual Studio, this is done by right click on the "References" in your project and using "Add Reference". For type providers, you also need to click "Enable" when the reference is loaded.

Resources