Thread: Betweenness Centrality Graph

  1. #1
    Registered User
    Join Date
    Sep 2017
    Posts
    3

    Betweenness Centrality Graph

    I'm not sure if can post this here as the question is not about the actual implementation in C but more of the theory necessary to implement the algorithm.

    I have a undirected weighted graph. I need to find the Betweenness centrality on a node x. For this I would need to find all the shortest paths from a node z to y and then the shortest paths from z to y with x in it.
    Any suggestions on which Algorithm to do this in the best possible time complexity ? I have to do this in C.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well I guess you start here -> Dijkstra's algorithm - Wikipedia

    But the shortest path with x might in fact be the longest path.

    So do you need to find all possible paths, and then sort them by length?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Sep 2017
    Posts
    3
    Quote Originally Posted by Salem View Post
    Well I guess you start here -> Dijkstra's algorithm - Wikipedia

    But the shortest path with x might in fact be the longest path.

    So do you need to find all possible paths, and then sort them by length?
    Have to find the shortest ones only. If the shortest path that goes through x is larger than the shortest path available without passing through x, then the value should be 0.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    So the answer is simple then.
    You find the shortest path.

    If that path contains x, then you do what you need to do.

    If it doesn't contain x, then your answer is by your definitions, zero.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Sep 2017
    Posts
    3
    Quote Originally Posted by Salem View Post
    So the answer is simple then.
    You find the shortest path.

    If that path contains x, then you do what you need to do.

    If it doesn't contain x, then your answer is by your definitions, zero.
    If I'm correct, I can also use Floyd's algorithm cause it finds all the shortest distances and paths from all nodes to every other nodes. But supposing there are multiple shortest paths of same size from to x to z, then I would have to modify the original algorithm to find these, correct ? Or is the complexity to high and Dijkstra be the best possibility to solve this problem ?

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    It looks like you know what to do - good luck.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Graph χ(G), ω(G) and g(G)
    By std10093 in forum Tech Board
    Replies: 8
    Last Post: 01-04-2013, 02:33 PM
  2. Graph
    By DeanWinchester in forum C Programming
    Replies: 1
    Last Post: 12-28-2011, 07:49 AM
  3. Graph - Help!! :(
    By Zeldic in forum C++ Programming
    Replies: 6
    Last Post: 06-02-2010, 08:15 AM
  4. need graph.h
    By h_howee in forum Windows Programming
    Replies: 3
    Last Post: 12-17-2005, 05:36 PM
  5. Graph
    By fkheng in forum C Programming
    Replies: 8
    Last Post: 07-05-2003, 10:57 PM

Tags for this Thread