Skip to content
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

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open

SNA #29

wants to merge 26 commits into from

Conversation

mstubbemann
Copy link
Contributor

Hey Tom,
this PR contains social analytics stuff that would probably be useful for SNA courses.
It includes:
-Average Shortest Path

  • K-Cores
  • Clustering Coefficients
  • Betweennes Centrality

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

Maximilian Stubbemann and others added 25 commits September 4, 2019 16:10
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.
@mstubbemann mstubbemann mentioned this pull request Sep 4, 2019
Copy link
Owner

@tomhanika tomhanika left a 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 ;)

@@ -117,6 +117,21 @@ metadata (as provided by def) merged into the metadata of the original."
(clojure.test/is true))))
body)))

(defn close?
Copy link
Owner

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?
Copy link
Owner

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

@mstubbemann
Copy link
Contributor Author

Done=)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants