Conversion of tree to graph data structure in java [closed]
Is it possible to convert a graph data structure to a tree data structure in java? If possible can some one provide me the source?
All trees are valid graphs. So this should work
Object ConvertTreeToGraph( TreeData t )
{
return t;
}
Yes, it is possible, just because a tree is a special graph. But as we have several datastructures to model trees and several datastructures for graphs it's not possible to give "one code to convert them all".
Further Reading
- Tree Structures
- Graph representations
精彩评论