Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
1

k-independence number in graphs

asked 4 years ago

salam gravatar image

I know how to find the independence number in graphs in sagemath. I want to obtain a new parameter called k-independence number in graphs which means the maximum size of a set of vertices at pairwise distance greater than k.

Would you please tell me how I can find this parameter in a graph?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 4 years ago

Max Alekseyev gravatar image

For a given graph G, we can construct a new graph H on the same set of vertices as G such that two vertices u and v are connected in H iff the distance between u,v in G is greater than k. Then the k-independence number of G equals the clique number of H.

Here is a sample code, which computes 1-independence number of Petersen graph.

from sage.graphs.distances_all_pairs import distances_all_pairs

def k_independence_number(G,k):
    D = distances_all_pairs(G)   # pairwise distances
    H = Graph([ G.vertices(), [(u,v) for u,N in D.items() for v,d in N.items() if d>k] ])
    return H.clique_number()

print( k_independence_number(graphs.PetersenGraph(),1) )
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 4 years ago

Seen: 442 times

Last updated: Feb 28 '21