-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SNA #29
base: dev
Are you sure you want to change the base?
SNA #29
Conversation
I implemented a function to compute all reachable nodes from a starting node via breadth-first-search. As it may be useful to also have the distances to the starting node (computing average-shortest-paths for example!) The new function returns a map with reachable nodes as keys and the distances to the starting point as values.
The new functionality allows to compute the k-cores of a given graph. The k-cores of a graph g are the connected components of the maximal subgraph in which each node has at least k neighbours.
Implemented tests for the k-cores-functions of context-to-graph-projections.
Added the functionality to compute the average shortest path length of a graph or context via breadth-first search.
Conflicts: src/main/clojure/conexp/fca/applications/socialanalytics.clj
Conflicts: src/test/clojure/conexp/fca/applications/socialanalytics_test.clj
Conflicts: src/test/clojure/conexp/fca/applications/socialanalytics_test.clj
If functions which operate with doubles are tested, it is possible that rounding errors occur and tests like (is (= a b)) will fail. For this reason I implemented a function ``close?`` that takes arguments x,y and epsilon and checks if |x-y| <= epsilon.
I moved all stuff concerning basic graph structuring, such as breadth-first search or computing graphs from contexts into a seperated file ``structure``.
The new version stores the whole adjacency-matrix and works also for directed graphs. Using the whole matrix and not just the upper triangle makes the code much smaller but slows down the computation with factor 2 as a drawback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump: If time, please attend to the comments ;)
src/main/clojure/conexp/base.clj
Outdated
@@ -117,6 +117,21 @@ metadata (as provided by def) merged into the metadata of the original." | |||
(clojure.test/is true)))) | |||
body))) | |||
|
|||
(defn close? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name 'close' might be ill chosen. Since we deal with a lot of clos(ures/ed) sets one might choose 'near' here maybe?
@@ -12,6 +12,14 @@ | |||
|
|||
;;; | |||
|
|||
(deftest test-close? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See other comment about close
Done=) |
Hey Tom,
this PR contains social analytics stuff that would probably be useful for SNA courses.
It includes:
-Average Shortest Path
I also did some restructuring of the social analytics functionality that was already merged into dev by an earlier PR:
General graph functionality (transforming contexts to graphs or adjacency maps etc.) and social analytics measures are now separated into two different files.
Regards,
Max