inserting new algorithm for metrics

Oct 1, 2012 at 4:53 AM


this is nancy. i am using NodeXL. it is extremely useful fro visualising the data. i am working with Social Networks especially. i have created an algorithm for finding a new centrality measure in java. how can i include the new code in the existing code? kindly provide me the necessary steps to be followed

Oct 2, 2012 at 12:48 AM
Edited Oct 2, 2012 at 12:54 AM

Hello, Nancy:

I want to make sure I understand what you need.  Do you want to create your own private, customized version of the NodeXL Excel Template that includes your new centrality measure, in addition to the centralities that NodeXL already calculates?

Also, please note that NodeXL is written for .NET, which is not directly compatible with Java.  There are commercially available  .NET-to-Java "bridge" solutions ("commercial" meaning that you pay for them), but I know nothing about them.  Are you willing to either buy such a bridge or rewrite your algorithm in C# or another .NET language?

-- Tony

Oct 21, 2012 at 7:21 AM

Hi Tony,

nodexl by default comes with lot of graph metrics. But if we have to include a new type of graph metric, how do we add it?

I checked the API chm file and i think we will have to subclass GraphMetricCalculatorBase. If its correct, then how do we integrate final compiled class with nodexl so that it will be listed when i click on 'graph metrics' in excel?



Oct 22, 2012 at 12:51 AM


NodeXL's architecture is "layered," meaning that many features are reusable outside of our Excel Template application.  That means you are going to have to modify more modules than if the graph metric features were hard-coded into the Excel Template.

Here is what you will need to do:

1. In the NodeXL\Algorithms project, add a MyGraphMetricCalculator class.  Derive it from GraphMetricCalculatorBase.  MyGraphMetricCalculator is application-agnostic; it knows nothing about the ExcelTemplate project.

2. Implement a MyGraphMetricCalculator.CalculateGraphMetrics(IGraph graph) method.  Its return type is up to you; there is no standard return type for graph metrics.

3. In the NodeXL\ExcelTemplate project, add a MyGraphMetricCalculator2 class.  Derive it from GraphMetricCalculatorBase2.  MyGraphMetricCalculator2 uses MyGraphMetricCalculator to calculate your graph metrics, and then it formats them into Excel workbook columns.

4. In the NodeXL\ExcelTemplate project, add a MyGraphMetrics member to the GraphMetrics enumeration in GraphMetrics.cs, and read the "Important Note" at the end of the enumeration concerning what else you need to modify.

If you want to follow the pattern I established for the existing graph metrics, see the NodeXL\Algorithms\GraphMetricCalculators\VertexDegreeCalculator.cs and NodeXL\ExcelTemplate\GraphMetrics\GraphMetricCalculators\VertexDegreeCalculator2.cs classes.  That's probably the simplest of the graph metric calculators.

-- Tony