MATLAB: Graph/centrality- Is there a way to avoid “Expected Cost to be positive” error

centralitygraphgraph theoryhelpnetwork analysis

Hi! I'm conducting centrality analysis on a set of nodes (XYZ) and edges. My edge cost is euclidean distance. However, I currently get an error each time I calculated weighted closeness or weighted betweeness saying that "expected cost to be positive." Why am I getting this error?
Here is my code:
figure('Name','Closeness-weighted')
wcc = centrality(G,'closeness','Cost',G.Edges.Weight);
p.NodeCData = wcc;
title('Closeness Centrality Scores - Weighted')
It is a large node dataset, and I think some of the edges start and end at the same node. Is this the problem? Can i remove these easily?
Sorry! I'm a beginner. Any help or resources would be greatly appreciated.

Best Answer

After contacting technical support, there is currently a bug in the centrality functions with large datasets (>100 nodes). They are currently looking into it. :)