# Problem with SystemGraph and CombinatoricaGraph functionality conflict

I'm trying to generate a random geometric graph. When evaluating HighlightGraph, even if I am passing graph object Mathematica always gives error like

A graph object is expected at position 1 in RowBox[{"HighlightGraph", "[", RowBox[{InterpretationBox[StyleBox[RowBox[{...

How can I solve this problem. I am new to Mathematica programming and am using Mathematica 9. my code is..

v = {};
For[i = 1, i <= n, i++, v = Append[v, {{Random[], Random[]}}]];
g = Graph[{}, v];
keyrings = {};
For[i = 1, i <= n, i++,
keyring = {};
If[P == K,
For[k = 1, Length[keyring] < K, k++,
keyring = Append[keyring, k]
],
(* P > K *)
For[k = 1, Length[keyring] < K, k++,
key = Random[Integer, {1, P}];
If[MemberQ[keyring, key] == False,
keyring = Append[keyring, key]
]
]
];
keyrings = Append[keyrings, keyring];
];
For[i = 1, i <= n, i++,
For[j = i + 1, j <= n, j++,
xi = Extract[Extract[Extract[v, i], 1], 1];
xj = Extract[Extract[Extract[v, j], 1], 1];
yi = Extract[Extract[Extract[v, i], 1], 2];
yj = Extract[Extract[Extract[v, j], 1], 2];
If[dist[xi, yi, xj, yj][[1]] < rc,
If[
Extract[keyrings, {i}] ⋂
Extract[keyrings, {j}] != {},
(* Else *)
Print["No secure link between ", i, " ", j]
]
]
]
];
HighlightGraph[g, {NeighborhoodGraph[g, 1], Labeled[1, 1]}];
Print[ShowGraph[g]]
]
]


-
Built in Mathematica functions and Combinatorica functions consider different things to be Graph's. Related: Use of MinimumSpanningTree –  Jacob Akkerboom Mar 13 '14 at 12:11
@user11609 it would be helpful to give a small example to work out where the problem arises –  ubpdqn Mar 13 '14 at 12:11
@m_goldberg I am confused about your opinion on Backquotes in titles. By the way, do you know how (if that is possible) to add "comments" (invisible text) to a queston/answer (maybe using html)? In the linked Q&A I would want to add the word backtick as a comment for search purposes. –  Jacob Akkerboom Mar 13 '14 at 12:27
@ubpdqn....i have edited the question and written the code..plz see –  user11609 Mar 13 '14 at 12:29
@JacobAkkerboom. I think this is a case where back ticks are OK. –  m_goldberg Mar 13 '14 at 12:29

Don't use Combinatorica. It's been obsolete since Version 8. Take a look at RandomGraph. With that you should be to get what you want. For example,

HighlightGraph[RandomGraph[{5, 6}], {1 -> 3}]


### Note

When one loads Combinatorica in V8 or later, one gets the message

General::compat: Combinatorica Graph and Permutations functionality has been superseded by preloaded functionality. The package now being loaded may conflict with this. Please see the Compatibility Guide for details.

-
i used this but giving error every time as mentioned in the question..i've inclued the code too..plz see –  user11609 Mar 13 '14 at 12:30
i've removed combinatorica still did not get the output –  user11609 Mar 13 '14 at 12:32
Ah, I suspected it might be, but I never saw this statement. If it is true that it is (fully?) obsolete, then this should get many upvotes :). –  Jacob Akkerboom Mar 13 '14 at 12:33
@user11609. Did you start a fresh Mathematica session to get rid of Combinatorica? As look as it's loaded, you will have problems. –  m_goldberg Mar 13 '14 at 12:49
yeah i did that too but still didn't get output....i'm trying this last three days and got nothing till now,, –  user11609 Mar 13 '14 at 12:58