pyRoCS is a library of functions used to support resilience analysis of complex systems. The package contains example datasets and tutorial to help demonstrate how the functions can be used.
Change the three graph metric functions in pyrocs/complex_systems/causal_complexity.py to allow both directed and undirected graphs in a similar way to the grc.py, with a boolean "directed" argument. Right now, functions assume the type of graph, which affects the number of edges, and presence of cycles. A directed graph with edges from A->B and B->A has two edges, but the undirected version has one edge, though they both generate the same numpy matrix. Also, the directed version has a cycle, whereas the undirected version doesn't.
cyclomatic_complexity assumes the graph is undirected and feedback_density assumes the graph is directed. Metrics will be incorrect when the matrix is generated by a different type from the one assumed by the function. causal_complexity, which uses both functions, is not correct for either type of graph.
Alternative fix: Change cyclomatic_complexity to create directed graph instead of undirected, if the intention behind all the metrics, is that they only take directed graphs.
Questions to answer
Should we add a boolean argument, or change cyclomatic_complexity to construct a directed graph?
Should the new argument have a default value?
Should functions allow both matrices and networkx graph objects directly so that graphs do not have to be converted to a numpy matrix to use the metrics?
Change the three graph metric functions in pyrocs/complex_systems/causal_complexity.py to allow both directed and undirected graphs in a similar way to the grc.py, with a boolean "directed" argument. Right now, functions assume the type of graph, which affects the number of edges, and presence of cycles. A directed graph with edges from A->B and B->A has two edges, but the undirected version has one edge, though they both generate the same numpy matrix. Also, the directed version has a cycle, whereas the undirected version doesn't.
cyclomatic_complexity assumes the graph is undirected and feedback_density assumes the graph is directed. Metrics will be incorrect when the matrix is generated by a different type from the one assumed by the function. causal_complexity, which uses both functions, is not correct for either type of graph.
Alternative fix: Change cyclomatic_complexity to create directed graph instead of undirected, if the intention behind all the metrics, is that they only take directed graphs.
Questions to answer