Use Gephi to display graphs in AnyLogic - anylogic

I've created an agent based model in AnyLogic and would like to visualize the graph. Ideally I'd like to use something like Gephi.
I've used the general visualization tools that come with AnyLogic to create a circle layout, but I'd much rather have something that is more useful, such as the Force Atlas 2.
Ideally, I'd like to have the graph visualized directly in one of the view areas. Any ideas? It seems that AnyLogic is awfully limiting in what you can do visually outside of its pre-packaged components (as vast as they are in their own right).

I agree that Gephi is a powerful tool for working with graphs, but I haven`t directly used it in AnyLogic so far.
Here is how I would try do it:
Download the Gephi Toolkit as a Java jar
Integrate it in your AnyLogic project: In the Project tab in your model's properties under Dependencies / Jar files and class folders add the downloaded jar file
Add the namespaces to your project by adding in your Main under Advanced Java / Imports Section (Here the example for the needed namespaces to generate graphs):
import org.openide.util.Lookup;
import org.gephi.project.api.Workspace;
import org.gephi.io.importer.api.Container;
import org.gephi.io.generator.plugin.RandomGraph;
import org.gephi.io.importer.api.ImportController;
import org.gephi.io.processor.plugin.DefaultProcessor;
import org.gephi.io.processor.plugin.AppendProcessor;
import org.gephi.io.generator.plugin.DynamicGraph;
Generate a graph, described in this example.
The only difficult or impossible thing might be integrating visualisation into the AnyLogic canvas. However you can always have a "popup" window as a JFrame as in this example.

Not sure what Gephi is but you can load any Java library into AnyLogic and use it. There are tons out there for vis, even 3D charts are possible.
So you are not limited by AnyLogic but by Java... which really isn't that much of a limitation ;-)
(Check AnyLogic help on how to load jar files)

Related

Model-to-Model-Transformation - no meta model for source

I have to do a model-to-model transformation but the source model is rather obscure but also quite similar to UML activity diagrams (which are also the target by the way).
I've looked into tutorials for Eclipse Modeling Tools but I struggle a lot with it. Also, because there is no meta model for the source, I'm not sure if EMT is any help. What are my options here? Can I use EMT, should I use another tool in this case or should I write a generator myself?
Greetings

What is a good StringTemplate plugin for Eclipse, so i can do cod gen?

I'm working on a eclipse-based model-based tool. I am not using UML/SysML but i created my own DSML (= component architecture, whereby components have a behavior, modeled using state automatons).
What I want to do now is to be able generate code and some config files from this model. So the question is: are there any good plugins out there, which would support that? (Tutorials wouldnt hurt either)
I did something similar in tool MPS (by jetbrains). It offers a string template language, that can be used for code gen. It would be cool to find something similar to it.
There is a plugin called StringTemplateDT in the eclipse market place. Does anyone have any experience with that?
best and thanks
Jenny
Give JET (Java Emitter Template) a try, it was relatively easy to pick up.
http://www.vogella.com/tutorials/EclipseJET/article.html

How do I import a complete model (ie multiple XMI files) into an Enterprise Architect Project

I am trying to take a copy of the XMI files for an Enterprise Architect model and then import them into a new EA project. The "Bulk Import" option doesn't seem to do what is says on the tin.
By figuring out now the package hierarchy is mapped into the EA xml files I could do this by importing the one file at at time starting from the root package, but this is implausibly time-consuming given the number of files involved. I have tried using the "ImportPackageXMI" method on the API to automate the manual approach, but this requires the parent package GUID to be known. For the root package(s) the parent is a "Model", which is created in the new EAP (maybe it has a GUID - but not that I can figure out) and there seems no simple way of recreating the package hierarchy in any case. (I was hoping that if I imported the xmi files - using a specially created root package - then EA would work out the package structure somehow, but this was not the case!)
This seems like it should be a trivial task that should be directly supported from the tool: export model, then import model. Maybe I'm missing something or there is a simple solution for this?
For clarity, I'm using the Desktop Edition (so no scripting available).
My actual goal was to create a copy of project (EAP) that was not associated with any source control settings : my attempts via export/import of the xml it seems was not the best way to achieve this!
A simple way I have found to is to create a new (project) EAP and then open the original EAP in another window (by clicking on the EAP file in Windows explorer). Once this is done the top level packages from a model in the original can simply be copied and then pasted - using the standard shortcuts - into a model in the new EAP, which is not associated with the original source settings. Hence new source control settings can be applied and the model controlled by a new source control technology.
You could simplify this task by using Project/Data Management/Project Transfer. This way a complete copy is done, which also includes the so-called reference data. XMI does only ex-/import elements and connectors (not for example image data, glossary, etc.).
The right way to do that is firstly create a Controlled Model Branch
Then you can Import this Model Branch and it will reconstruct your complete model (branch) from all the xmi files involved.

Is the J2SE com.google.zxing.client.j2se.MatrixToImageWriter still the standard way to write barcodes?

I notice that there are a lot of old tutorials from about 2010 that use
com.google.zxing.client.j2se.MatrixToImageWriter
to write 2D barcodes to files.
Also, I notice a lot of old tutorials specify the use of Android.
I am using Eclipse on Linux Mint, not Android.
Eclipse will happily import the main src tree of java files and show them as available packages. For example, I can get all the packages under zxing/core/src/main/java to show up; I can import classes from those packages and compile them.
However, I can't seem to import the com.google.zxing.client.j2se package when I have the core packages imported, and vice versa.
If there is a way to write BitMatrix objects to files without using
com.google.zxing.client.j2se
that would simplify matters.
Alternatively, if there is some way to get Eclipse to import both sets of packages, that might be an alternative. I have already tried modifying the "filters" under the "properties" tab, on the theory that if I can use two filters, the first can pick up
core/src/main/java
and the second can pick up
/javase/src/main/java/
But that didn't work for me.
Suggestions are welcome. Thanks.
Ran into the same problem with the import. It appears that we both forgot to add the javase.jar into the project. Download it from here, import and you will be able to import MatrixToImageWriter.

What is a good visualization library for creating state diagrams and animations?

I'd like to post-process log files and extract node data and transitions, and then graph them in a gui of some kind. So, I'd like to programmaticly draw bubble diagrams, maybe with animations showing packets going from node to node.
Ideally, perl or java would be the language of choice, but anything that runs on a linux platform would be fine.
What is the best library for this kind of thing?
Java Solutions
Two possibilities in Java include Prefuse and Visual Library. They both have the ability to display graphs with some animation ability. Prefuse has better graph layouts. Visual Library is more Swing-like if you are used to Swing development.
Adobe Flash
If you are willing to work with Adobe Flash, Flare is probably a little more suited to your task as it has better animation capabilities and has good graph layouts.
Animation Libraries
If your diagrams are fairly simple, you could create your own diagrams and use the Timing Framework or Trident for animation.
Other
Some other possibilities include Processing and JavaFX. Javascript libraries include ProcessingJS and Protovis.
Graphviz will draw you static diagrams. It can't do animations as far as I know.
If you can convert the output into graphviz dot format (graphviz) than you can use idot incremental viewer (iDot_incremental_viewer) which uses prefuse behind the scenes and it's completely free. The only thing you need to do here is to convert the output in simple dot file. Rest will be taken care of incremental viewer.