私はs'Graph
とc'Graph
をSystem'Graph
とCombinatorica'Graph
(とCombinatoricaと競合する他の機能)を参照することができるようにしたいと思いますか?サイモンのアイデア後コンテキストパスのエイリアスを作成しますか?
は、以下の
{Set @@ {ToExpression["c" <> Last[StringSplit[#, "`"]]],
ToExpression[#]}} & /@ Names["Combinatorica`*"];
{Set @@ {ToExpression["s" <> Last[StringSplit[#, "`"]]],
ToExpression[#]}} & /@ Names["System`*"];
今cCompleteGraph[5]
とsCompleteGraph[5]
リターンCombinatorica
と今後の参考のために、それぞれ
更新月8日 System
グラフを動作しているようですが、これは私が終わった方法がありますGraphUtilities
,Combinatorica
と組み込みのグラフ機能を一緒に使用します。これは、すべての呼び出しでCombinatorica
を$ContextPath
に追加するので、Graph
のようなすべてのcombinatorica関数をcGraph
に再マッピングし、$Post
を変更して、各評価でContextPathからGraphUtilitiesとCombinatoricaを削除する必要があります。
要約すると、各セッションの開始時に以下のコードを実行します。もちろん
$PreRead = # /. {str_String :>
StringReplace[
str, {RegularExpression["^s`(.*)"] :> "System`" <> "$1",
RegularExpression["^c`(.*)"] :> "Combinatorica`" <> "$1"}]} &
、これは非常に低いレベルで働いているので、取る:Combinatoricaのfuncは今cfunc
で、GraphUtilitiesのfuncがちょうどfunc
Needs["Combinatorica`"];
combNames = Names["Combinatorica`*"];
{Set @@ {ToExpression["c" <> Last[StringSplit[#, "`"]]],
ToExpression[#]}} & /@ Names["Combinatorica`*"];
Needs["GraphUtilities`"];
$ContextPath = DeleteCases[$ContextPath, "Combinatorica`"];
$Post = ($ContextPath =
DeleteCases[$ContextPath,
"Combinatorica`" | "GraphUtilities`"]; #) &;
いくつのシンボルが必要ですか? cGraph = Combinatorica'Graph(そして、$ ContextPathのCombinatoricaを保つ)を実行することは実現可能でしょうか? – Janus
これはv8のことですか?私のv7システムでは、 'Intersection @@(Names [#<>" \ '*"]&/ @ {"Combinatorica"、 "System"}) 'は空のリストを返します。 – Janus
うん、バージョン8、今は2つのタイプのグラフオブジェクトがあります。WRIがCombinatoricaの機能を組み込み関数に置き換えるようです。 –