alyzers that are to be presented on the new user
interface. The getGraphAnalyzer(id: String)
method returns a given analyzer so that it can be
called using its id.
2.1.2 Example of Extending the Core with a
New Algorithm
As a result of the above presented structure of the
core package adding a new graph analyzing algo-
rithm does not require any changes of the code of
the user interface or of the adapter class. The algo-
rithm will be represented by a class that implements
the GraphAnalyzer interface. In the class, one can
freely define either private or public methods to
help structure the algorithm code. The algorithm pro-
duces the result as the return value of the analyze
method, which is a collection of the above mentioned
result types. This allows an algorithm to produce mul-
tiple results, even in different formats. A typical ex-
ample is when an algorithm produces a given result
for being processed directly by the interface and also
a FileResult that can be saved by the user for later
use.
In order to present how exactly a new algorithm
can be added to the package let’s see how we have
added the algorithm counting different types of trian-
gles in the graph. A triangle means a triad of nodes
where there is a link between each two nodes. Taking
into account the direction of edges there are 7 differ-
ent possible types of triangle in directed graphs (see
(Roughgarden, 2014; Suri and Vassilvitskii, 2011)).
Our implementation counts the number of triangles of
all these types. The first step is to create a new class
in the algorithms package (this will be the Triangles
class in this case) that extends the GraphAnalyzer
interface. This results in a class that must contain an
analyze function with the Collection return value
containing elements of type AnalysisResult, and a
getName function that can be implemented by return-
ing the desired name in the form of a string (in this
case it will be Triangles as well).
The next step is to decide what type of result or
results we want to produce. In this case we chose one
MapResult and one FileResult. This is because we
want to display the number of different types of trian-
gles in the form of a key-value pairs and in addition,
we want to make the analysis results available in a
savable format.
To implement the algorithm, we needed a
Triangle model class to represent a triad of nodes.
This model can tell us the type of relationship be-
tween the three nodes it contains. The implementa-
tion of the equals method allows two triangle models
to be considered the same, regardless of the order of
the nodes. (Note that one possible type of triangle can
appear in several forms as a result of reflection and/or
rotation). Utilizing this, our algorithm generates all
the triangles in the graph that are stored in a set. Due
to the proper equals method, a triangle is discovered
only once.
By iterating through the various triangle types, we
filter out and count the number of triangles found cor-
responding to each type. These results are then added
to a MapResult and to a FileResult in the appro-
priate format. Finally, we place the two results into a
list, which is returned by the analyze method.
It is important to note that we are currently work-
ing on extending the application with new algorithms
using the above procedure. Beside adding our own
implementations we have good experiences while try-
ing to include third party algorithms as well. Namely
we have added successfully the implementation of the
Tarjan algorithm by JGrapht to the core package and
made it visible on the web-interface as well.
2.2 The Web User Interface
Although the core Java package is implemented in a
way that makes it easy to run the algorithms as a part
of a Java program, calling these algorithms from a
user friendly interface is of course much more com-
fortable. So we have developed a web user interface
to the application fulfilling the natural requirement of
users.
2.2.1 Technologies and Frameworks of the Web
User Interface
Figure 2: The architecture of the web user interface. We
follow client-server architecture using the technologies pre-
sented on the figure. The Java core package is added to the
server side so the algorithms run there.
The web-application is implemented according to
client-server architecture. The server role is provided
Introduction to DiNA: An Extendable Web-application for Directed Network Analysis
131