# subgraph extractor

I am using the subgraph extractor to get statistics on each subgraph in my network and noticed that the number of edges calculated for each subgraph includes the number of edges that are outbound from that subgraph to the rest of the network which doesn't seem correct.  Also when I run network analyzer on each subgraph it doesn't report the total weight for the subgraph but the weight for each node.

It would be better if the subgraph extractor would calculate the correct number of edges for the subgraph, report the total weight for the subgraph AND as a bonus report the variance of the weight for the subgraph (as a proxy for the eigenvalue).  I am not a KNIME developer nor a Java programmer.  I am a statistician but have some Java programmer friends that might be able to help create a new KNIME node to do that.

Any thoughts?

Thanks,

Pat

Hi Pat,

depending on the used Sub graph diameter parameter of the SubGraph Extractor node the sub graph includes or excludes edges to vertices outside of the sub graph e.g. the default diameter of 3 does also include edges to vertices outside of the subgraph.

Since KNIME internally represents edges also as vertices (for details about the internal representation see the supported network types page.) the diameter includes the hop from the original vertex to its edges e.g. a diameter of 2 is from the origin node to its edges to its direct neighbors. If you would also like to include the edges between the direct neighbors of the origin node you would choose a diameter of 3 which is from the node to its edges to its directed neighbors to their edges.

I’m not sure if I got the weight computation right but if you would like to sum up the weight of all edges within the subgraph you can do it by looping over each subgraph, extracting the weight of all edges and using the GroupBy node to compute the sum, mean, variance, etc. of them.

Attached you can find an example workflow that demonstrates the difference between a diameter of 2 and 3. It also shows how to filter the edges that are connected to vertices outside of the sub graph by using the edge degree filter and a min node degree of 2.

The attached workflow further shows how to compute the weight sum, mean, deviation, etc. of all edges of a subgraph by using loops and the GroupBy node.

Bye,

Tobias

Hi Tobias,

Your reply appears to directly address all of my concerns.  I'll have a look at the workflow, give it a shot and let you know how it turns out.

Thanks,

Pat

Hi Tobias,

Your solution was almost perfect. I added a count on the number of Object Ids in the GroupBy node to get the correct number of edges.

Thanks again,

Pat

ps I sent you a Linkedin invitation