SubLink.m

From Knot Atlas
Revision as of 19:58, 18 November 2007 by IvaH (talk | contribs) (New page: (* The program <code>SubLink</code>, documented in the page on Prime Links with a Non-Prime Component. It is not part of the package <code>KnotTheory`</code> but is designed to work w...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

(*

The program SubLink, documented in the page on Prime Links with a Non-Prime Component. It is not part of the package KnotTheory` but is designed to work with it. Use Import["http://katlas.org/wiki/SubLink.m&action=raw"] to download into a mathematica session, or copy-paste the text below ignoring the *) on the first line and the (* on the last.

*)
SubLink[pd_PD, js_List] := Module[
  {k, t0, t, t1, t2, S, P},
  t0 = Flatten[List @@@ Skeleton[pd][[js]]];
  t = pd /. x_X :> Select[x, MemberQ[t0, #] &];
  t = DeleteCases[t, X[]];
  k = 1;
  While[
   k <= Length[t],
   If[ Length[t[[k]]] < 4, 
     t = Delete[t, k] /. (Rule @@ t[[k]]), ++k];
   ];
  t1 = List @@ Union @@ t;
  t2 = Thread[(t1) -> Range[Length[t1]]];
  S = t /. t2;
  P = If[S != PD[] && Length[S] >= 3, S, PD[Knot[0, 1]], S]
  ];
SubLink[pd_PD, j_] := SubLink[pd, {j}];
SubLink[L_, js_] := SubLink[PD[L], js];
(* 

*)