I'm wondering if I can use A* algorithm to check if the graph is K3 free?? if yes how can I do that? How can I deal with f, g , and h functions. if no what is the best algorithm to use except DFS and BFS.
Thanks
I'm wondering if I can use A* algorithm to check if the graph is K3 free?? if yes how can I do that? How can I deal with f, g , and h functions. if no what is the best algorithm to use except DFS and BFS.
Thanks
A* is not an appropriate tool for this problem. Iterate through the edges in the graph and check whether their endpoints have a neighbor in common. user482594's BFS solution fails to detect K3s consisting of vertices at equal depth in the BFS tree.